Hello guys, my scenario is following 1. I have LVM group named "system" 2. I have a logical volumes - system/root , ext3 mounted as / (20GB) - system/swap, swap - system/home, ext3 mounted as /home (431GB) I need to shrink system/home to 80GB (currently there is 57GB used) and use free space to create another logical volumes. My scenario is 1. reduce ext3 fs size to 80GB by using resize2s 2. reduce system/home size by using lvreduce 3. create another logical volumes Questions 1. How can i be sure that i will shrink ext3 to exact size 80GB and that the same will lvreduce do? I do not want to cut from ext3 filesystem if i will reduce logical volume too much 2. Can you please send me commands to achieve 1) and 2) part of my scenario? 3. Or can i just use lvreduce and my ext3 will shrink automatically? 4. Do i need to umount system/home when resizing? Thanks in advance! David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20081029/85a7d501/attachment-0003.html>
On Wed, Oct 29, 2008 at 12:58:32PM +0100, David Hl??ik wrote: <snip>> 1. How can i be sure that i will shrink ext3 to exact size 80GB and thatdev=/dev/system/home resize2fs $dev 80G Then, to be sure of the real size: blks=$(tune2fs -l $dev | awk -F: '/Block size/ { print $2/512 }') fssize=$(tune2fs -l $dev | awk -v bs=$blks -F: '/Block count/{print $2*bs}') Now, $fssize has the complete size in bytes. Verify it: echo $fssize Now, for lvresize: lvresize -L 80G system/home Verify that the printed target size matches the wanted value.> 3. Or can i just use lvreduce and my ext3 will shrink automatically?NO! lvreduce doesn't care about what's inside, and will happily lose data.> 4. Do i need to umount system/home when resizing?Yes, and you must do a full fsck also: e2fsck -f /dev/system/home Regards, Luciano Rocha -- lfr 0/0 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20081029/a3b705b0/attachment-0003.sig>
> > > Now, for lvresize: > lvresize -L 80G system/homeAre you sure there should not be lvreduce -L 80G system/home ? Thanks! D.
Hi, On Wed, Oct 29, 2008 at 07:58, David Hl??ik <david at hlacik.eu> wrote:> How can i be sure that i will shrink ext3 to exact size 80GB and that the > same will lvreduce do? I do not want to cut from ext3 filesystem if i will > reduce logical volume too muchReduce the filesystem to 78G or 79G with resize2fs, then reduce the LV to 80G, then grow the ext3 filesystem again to fill all the LV. This should make it safer when cutting the LV. HTH, Filipe