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

RE: [Xen-users] LVM and resize2fs


  • To: "Simon Hobson" <linux@xxxxxxxxxxxxxxxx>, <Xen-users@xxxxxxxxxxxxxxxxxxx>
  • From: "Jonathan Tripathy" <jonnyt@xxxxxxxxxxx>
  • Date: Thu, 7 Oct 2010 10:36:24 +0100
  • Cc:
  • Delivery-date: Thu, 07 Oct 2010 02:37:55 -0700
  • List-id: Xen user discussion <xen-users.lists.xensource.com>
  • Thread-index: Actl/hLxKaBs/juIQy6A1ils7di23AABFVI7
  • Thread-topic: [Xen-users] LVM and resize2fs


 


From: xen-users-bounces@xxxxxxxxxxxxxxxxxxx on behalf of Simon Hobson
Sent: Thu 07/10/2010 09:56
To: Xen-users@xxxxxxxxxxxxxxxxxxx
Subject: 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.

-----------------------------------------------------------------------------------------------------------

Ah right, so this issues only really occurs when downsizing a disk then? When upsizing (as mentioned in my first post), there isn't an issue, as resize2fs would have thrown an erro, correct?

Also, on a slightly off-top note, I made a mistake: I dd'ed an image file over to a non-exsistent LV. However, dd created a new file in /dev/vg0 !! Is this really bad? Could I have currupted some of the LVs? Or is it safe to just remove the new file using rm?

Thanks

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

 


Rackspace

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