Resize disk / detect new disk cheatsheet
When you resized virtual disk on your hypervisor, you would love to have space visible in your linux, for that you need to resize block device by command
[shell]
# for i in `ls /sys/block/`; do echo 1 > /sys/block/$i/device/rescan ; done
-bash: /sys/block/dm-0/device/rescan: No such file or directory
-bash: /sys/block/dm-1/device/rescan: No such file or directory
-bash: /sys/block/dm-2/device/rescan: No such file or directory
-bash: /sys/block/fd0/device/rescan: No such file or directory
[/shell]
(it’s actually going thru all devices that you have), if you know device name you just need to do:
[shell]
echo 1 > /sys/block/DEVICE_NAME/device/rescan
[/shell]
And of course, you need to resize your pv. If you know device name just run (let’s say it’s sda):
[shell]
#pvresize /dev/sda
[/shell]
If not you have oneliner:
[shell]
#for i in `pvs –noheadings | awk ‘{print $1}’`; do pvresize $i ; done
[/shell]
This will resize all that needs resizing 🙂 Now you can see correct space