Resizing/Adding VMware disk + Linux guest
You have Linux guest running on top of a (recent) VMware esx and you want to extend one of the disks (Not the root fs) ? You can do it without a reboot/downtime
- Resize the disk on VMware (e.g via virtual center)
- Go to the Linux guest os and run:
echo "1" > /sys/class/scsi_device/your_device/device/rescan
Check with dmesg is the kernel sees the new size. Should show something like this:
SCSI device sda: 209715200 512-byte hdwr sectors (107374 MB)
sda: test WP failed, assume Write Enabled
sda: cache data unavailable
sda: assuming drive cache: write through
sda: detected capacity change from 85899345920 to 107374182400
Now you can use parted or some other tools to resize the partition+filesystem.
Suppose you added a disk to a running VMware instance. No problem
- From within the Linux guest OS run:
echo "- - -" > /sys/class/scsi_host/host0/scan
Check with dmesg if the system sees the new disks
Vendor: VMware Model: Virtual disk Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
0:0:1:0: mptscsih: ioc0: qdepth=32, tagged=1, simple=1, ordered=0, scsi_level=3, cmd_que=1
target0:0:1: Beginning Domain Validation
target0:0:1: Domain Validation skipping write tests
target0:0:1: Ending Domain Validation
target0:0:1: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127)
SCSI device sdb: 1048576000 512-byte hdwr sectors (536871 MB)
sdb: test WP failed, assume Write Enabled
sdb: cache data unavailable
sdb: assuming drive cache: write through
SCSI device sdb: 1048576000 512-byte hdwr sectors (536871 MB)
sdb: test WP failed, assume Write Enabled
sdb: cache data unavailable
sdb: assuming drive cache: write through
sdb: unknown partition table
sd 0:0:1:0: Attached scsi disk sdb
sd 0:0:1:0: Attached scsi generic sg1 type 0
Another interesting (related) read: http://www.vmware.com/pdf/esx3_partition_align.pdf
March 11th, 2010 - Posted in vmware | | 0 Comments
