[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-users] LVM and resize2fs

Jonathan Tripathy wrote:

Would resize2fs allow you to "over-commit" ? I'd imagine that if the LV size was smaller than expected, wouldn't it throw an error?

Indeed it does :

# lvm lvcreate -n test -L 1G vg0
  Logical volume "test" created
# mkfs -t ext3 /dev/vg0/test
# fsck -f /dev/vg0/test
# resize2fs /dev/vg0/test 2G
resize2fs 1.41.3 (12-Oct-2008)
The containing partition (or device) is only 262144 (4k) blocks.
You requested a new size of 524288 blocks.

So there's no problem resizing the filesystem.

What that won't help with is if you resize the underlying volume to be too small for the filesystem :

# lvm lvcreate -n test -L 3G vg0
  Logical volume "test" created
# mkfs -t ext3 /dev/vg0/test
# fsck -f /dev/vg0/test
# resize2fs /dev/vg0/test 2G
resize2fs 1.41.3 (12-Oct-2008)
Resizing the filesystem on /dev/vg0/test to 524288 (4k) blocks.
The filesystem on /dev/vg0/test is now 524288 blocks long.

# lvm lvresize -L 1G /dev/vg0/test
  WARNING: Reducing active logical volume to 1.00 GB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce test? [y/n]: y
  Reducing logical volume test to 1.00 GB
  Logical volume test successfully resized
# fsck -f /dev/vg0/test
fsck 1.41.3 (12-Oct-2008)
e2fsck 1.41.3 (12-Oct-2008)
Superblock has an invalid ext3 journal (inode 8).
Clear<y>? no

fsck.ext3: Illegal inode number while checking ext3 journal for /dev/vg0/test

To prevent that, LVM would need to know about what might be in the volume and prompt you accordingly - but then it would lose that decoupling between storage volumes and filesystems. Ie, if LVM "knew about" ext2/3 (and all the other) filesystems, then it could check the contents of the volume and ask you if you were sure you wanted to screw up your data. It would significantly increase the complexity of LVM to be able to do that though.

Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

Xen-users mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.