Click to See Complete Forum and Search --> : xfs_grow and virtual machines


mungecursor
09-24-2009, 04:14 PM
I've inherited some sys-admin duties and am not sure if I'm seeing this correct.

There is a virtual machine running vmware, and on it are three virtual machines, one of them being an archive server. The file system on the archive server uses lvm on an xfs file system.

#uname -a
2.6.9-78.0.22.plus.c4 #1 Mon May 11 07:03:27 EDT 2009 i686 athlon i-386 GNU/Linux



on the vmware server

#lvdisplay
<snip>
--- Logical volume ---
LV Name /dev/vg1/leo.mirror
VG Name vg1
LV UUID WWgdNf-dYhR-fy7K-zauM-uK9A-aKuJ-E4Gcxv
LV Write Access read/write
LV Status available
# open 1
LV Size 600.00 GB
Current LE 9600
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:9
</snip>


# fdisk -l
Disk /dev/sda: 1999.9 GB, 1999978364928 bytes
255 heads, 63 sectors/track, 243150 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 195313 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 25 49 195313 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 49 6128 48828125+ 8e Linux LVM
/dev/sda4 6128 243151 1903885056+ 8e Linux LVM



on the virtual machine
#mount
<snip>
/dev/sdb1 on /mnt/md0 type xfs (rw)
</snip>

#fdisk -l
<snip>
Device Boot Start End Blocks Id System
/dev/sdb1 1 78325 629145531 83 Linux
</snip>


My question is this, is the "xfs_grow" command used on the virtual machine on a live mount point? Example, assuming I want to add all the remaining space to the mount point /mnt/md0 on the virtual machine:

#xfs_grow /mnt/md0


I'm VERY green when it comes to virtual machines, and the data is easily worth seven figures (isn't downsizing fun), I would like to make sure before going forward.

tia

retsaw
09-24-2009, 08:25 PM
Yeah, that's how you use it.

You didn't say if you've already done it or not, but you need to increase the size of the partition the XFS filesystem is on before using xfs_grow since it needs space to grow into.

mungecursor
09-25-2009, 07:14 AM
Yeah, that's how you use it.

You didn't say if you've already done it or not, but you need to increase the size of the partition the XFS filesystem is on before using xfs_grow since it needs space to grow into.


Thanks for the reply. If this wasn't a vmware box, I'd know how to check the partitions, and I'll apologize ahead of time because I'm a cad operator, not a sys admin.

What would be the best way to check/grow partitions on a vm server?

happybunny
09-25-2009, 01:43 PM
Is this actually VMWare Server?

vmkfstools (on VMWare ESX) works on the underlying vmdk files to grow or shrink them.

So from the hosting server you can change the size of the vmdk file that make up your virtual machine.

Then inside the virtual machine you will see a new empty partition that you can consume (by expanding the current partition and growing the format or by creating a new partition and expanding the LVM to it).

Also: BACKUP BACKUP BACKUP!!!

Take the time to halt this virtual machine and copy (several times) the large .vmdk files that make up this guest. The put them to tape. Then ship that tape to the other side of the world. Then ... well, you get the idea.

retsaw
09-27-2009, 06:49 PM
From what you put in your first post I get the impression that the VMWare Server is using a LVM volume directly for the virtual disk on your virtual server, but the virtual server is not using LVM. Now, I'm not familiar with VMWare, so you should definitely check its documentation on increasing the size of the virtual hard drive to see if there are any special commands you need to invoke, but it may be as simple as increasing the LVM volume size, repartitioning the drive in the virtual machine*, rebooting the virtual machine to update the partition table in the kernel**, then doing the xfs_grow.

Oh, and as happybunny pointed out, don't forget to backup, well, you should be doing that anyway and I think it is quite unlikely doing this will case data loss, but better safe than sorry.

*You may possibly need to reboot the virtual machine here to get it to see the larger virtual disk, I would think VMWare would enable it to be seen straight away, but I really don't know.

**You can force a re-read of the partition table without rebooting if you want to, but only if you unmount all partitions on that disk, so it would probably be simpler to reboot anyway.