Skip to contentSkip to conversation

How To Question

linux-lvm duane no-name 2 participants 2 messages Jan 28, 2004

lore
Share & tools
lore
#0 lore raw

Perhaps this is more obvious to others - but it is not obvious to me after reading the howtos and docs.

The Docs - common tasks section has part of my answers, but it lacks what I believe to be a commbined two step example.

Right now, I have a single /var/foo implimented as an LVM vol using reiserfs. It turns out - I allocated too much space to it.

I now need a /var/bar.

I'd like to re-allocate or shrink /var/foo by say 20G, and give it to /var/bar.

The "How To" do this two step process is not very clear in the docs.

I'm quite able to shrink and expand /var/foo - at will. My confusion is - now that I have shrunk it - reallocate the space I just got back?

What am i not reading correctly?

Thanks.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

#1 lore raw
Quoted 11 lines · duane

Right now, I have a single /var/foo implemented as an LVM vol using reiserfs. It turns out - I allocated too much space to it.

I now need a /var/bar.

I'd like to re-allocate or shrink /var/foo by say 20G, and give it to /var/bar.

The "How To" do this two step process is not very clear in the docs.

For reiserfs the (safe = unmounted logical volume) steps are:

1) umount the logical volume that contains the reiserfs to shrink.
2) Shrink the reiserfs by a specific amount using resize_reiserfs.
3) Reduce the logical volume containing the reiserfs using lvreduce by exactly the same amount as in step 2 above.
4) mount the just shrunk/reduced reiserfs/logical volume.

It may help to relate the mount point /var/foo to the actual LVM lv device for example, /dev/vg/foo. The four steps above would become:

# umount /var/foo
# resize_reiserfs -s -20G /dev/vg/foo
# lvreduce --size -20G /dev/vg/foo
# mount -t reiserfs /dev/vg/foo /var/foo
Quoted 3 lines

I'm quite able to shrink and expand /var/foo - at will. My confusion is - now that I have shrunk it - reallocate the space I just got back?

The following command will report the size of the logical volume:

# lvdisplay /dev/vg/foo

The reported size after the shrink/reduce should 20GB less than before.

To use the freed space, do one or more the following two things:

1) Create a new logical volume in the vg volume group using lvcreate. (For example, a new /dev/vg/bar to be mounted on /var/bar.)

2) Extend another volume with lvextend and enlarge its filesystem by the exact same size using the appropriate filesystem resizing tool.

Sincerely,

Ken Fuchs <[email protected]>