How do I rescan drives I've expanded?
By Daniel Rodriguez •
I frequently expand drives on my VMs. How can I rescan the drives without rebooting the server?
2 Answers
The easiest solution is to use scsitools script rescan-scsi-bus.
sudo apt-get install scsitools
sudo rescan-scsi-busTo do it without installing a utility on 14.04:
echo '1' > /sys/class/scsi_disk/0\:0\:0\:0/device/rescanIMPORTANT: Be sure to replace the 0:0:0:0 with the appropriate disk for your purposes.
Example for system disk without reboot:
Rescan the bus for the new size:
# echo 1 > /sys/block/sda/device/rescanExpand 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 partitionResize it:
# resize2fs /dev/sda2
More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"