Filesystem not recognized when resizing disk

I have created a new CentOS 6.2 x86_64 VM on Citrix XenServer and created an image of this in Cloudmin as a template.

During the install I created a single partition on the virtual disk, the goal being that Cloudmin will know how to resize it. My first attempt had separate /boot, / and swap partitions but Cloudmin did not know how to handle that.

With a single partition Cloudmin does now resize the disk without error, but it still fails to detect the filesystem on the disk and resize it. I am using ext4. Is this supported by Cloudmin? If so what am I doing wrong?

After resize, ‘fdisk -l /dev/xvda’ says:

Disk /dev/xvda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b444b

Device Boot      Start         End      Blocks   Id  System

/dev/xvda1 1 1246 10000000+ 83 Linux

but ‘df -h’ says my filesystem is still 8GB:

Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.9G 900M 6.6G 12% /
tmpfs 245M 0 245M 0% /dev/shm

Howdy,

What steps are you taking to resize your disk there?

-Eric

  1. Go to System State -> Shutdown System, wait for it to power off

  2. Resources -> Manage Disks, click on my virtual disk containing the / partition:
    “Storage ams1-san-1 ID cw-as-0.ams1-cloudmin.anu.net_xvda Xen device A Storage Hard disk 10 GB”

  3. Increase the value of the “Disk file size” field, hit Save.

  4. I get a message:
    “Warning - this disk cannot be safely resized. Cloudmin does not know what type of filesystem this disk contains, and so cannot properly resize it. This is most likely because the disk is not mounted on the virtual system.”
    I click “Resize Disk Anyway”

  5. I get a message:
    “Updating virtual disk on b5cdab3f-cae3-4828-9882-8bb493e6756e …
    … updated successfully”
    But powering on the VM only shows a larger virtual drive, the filesystem is the same size as previously and has not been expanded to consume the additional space.

This problem could have two causes :

  1. The filesystem on the disk isn’t something Cloudmin supports resizing of, like reiserfs

  2. The disk wasn’t listed in /etc/fstab , so Cloudmin didn’t know what filesystem type it contained.

Could either of those be the case here? I’d be interested in seeing the /etc/fstab file from this VM…

Thanks for getting back to me, the problem was with fstab. The default fstab created by anaconda had the volume label instead of the device:

UUID=5baf228f-ed08-4320-b1f5-11ecaa6f191b / ext4 defaults 1 1

I changed that to:

/dev/xvda1 / ext4 defaults 1 1

And tried again, now I get:

Updating virtual disk on b5cdab3f-cae3-4828-9882-8bb493e6756e …
… update failed : Failed to expand filesystem : Couldn’t find valid filesystem superblock. resize2fs 1.39 (29-May-2006) resize2fs: Filesystem has unsupported feature(s) while trying to open /dev/xvdb1

It is an ext4 filesystem with these features:

tune2fs -l /dev/xvda1 | grep features

Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize

Is ext4 not supported by resize2fs? Or is there a particular feature that needs to be disabled?

Does your host system have the resize4fs command installed? This is needed to expand an ext4 filesystem … and unfortunately it needs to be run on the host system.

It is possible this is missing from Citrix XenServer hosts. For this reason, the standard Cloudmin images always use ext3 filesystems, as resize2fs (which also supports ext3) is more commonly available.

Solved this by installing e4fsprogs on all our XenServer boxes: yum -y --enablerepo=base install e4fsprogs

Resizing now works perfectly!!