I frequently expand drives on my VMs. How can I rescan the drives without rebooting the server?


The easiest solution is to use scsitools script rescan-scsi-bus.

sudo apt-get install scsitools
sudo rescan-scsi-bus

To do it without installing a utility on 14.04:

echo '1' > /sys/class/scsi_disk/0\:0\:0\:0/device/rescan

IMPORTANT: Be sure to replace the 0:0:0:0 with the appropriate disk for your purposes.

| improve this answer | |

( A bit old question )
Example for system disk without reboot
Rescan the bus for the new size :

# echo 1 > /sys/class/block/sda/device/rescan

Expand your partition ( Works with ansible )

# parted ---pretend-input-tty /dev/sda resizepart F 2 Yes 100%
- F for Fix 
- 2 for partition
- Yes to confirm
- 100% for whole partition

Resize it

# resiz2fs /dev/sda2
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.