[linux-lvm] How To Question
Ken Fuchs
kfuchs at winternet.com
Wed Jan 28 13:23:02 UTC 2004
duane wrote:
>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
>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 <kfuchs at winternet.com>
More information about the linux-lvm
mailing list