When adding a new disk to a live system (e.g. a linux VM), the new disk may not always show up. Additionally, when resizing a disk through the hypervisor, the VM may not always immediately have the new size available for use. Luckily, you can trigger a rescan of the SCSI bus through the sysfs system.
For this to work, you'll need to have shell and root access to the server/VM.
Modern linux kernels automatically detect the addition of a disk, but in case it doesn't, you can trigger a rescan of a specific (virtual) SCSI controller:
echo "- - -" > /sys/class/scsi_host/hostX/scan
Replace hostX with the number of the SCSI controller, where host0 is the first, host1 is the second, etc. You can do an ls /sys/class/scsi_host to see which controllers are available. If you're uncertain on which controller the new disk was connected to, it doesn't hurt to run a rescan on all available controllers.
When resizing a disk, the linux kernel usually doesn't pick up the change right away. You can trigger a rescan of the specific disk device:
echo "1" > /sys/class/block/sdX/device/rescan
Replace sdX with the exact device node of the disk to rescan. Which this is depends on the type of disk (and moreover, the driver that's backing the SCSI/SATA/PATA controller), but modern linux kernels almost always refer to disk devices as if it was a SCSI disk, meaning that sda is the first disk, sdb the second, and so on.
« ‹ | October 2024 | › » | ||||
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |