I have LVM group named "system"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
reduce ext3 fs size to 80GB by using resize2s
reduce system/home size by using lvreducecreate another logical volumesQuestions
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
Can you please send me commands to achieve 1) and 2) part of my scenario?Or can i just use lvreduce and my ext3 will shrink automatically?Do i need to umount system/home when resizing?Thanks in advance!
David
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
10-29-2008, 11:12 AM
Luciano Rocha
resize LVM (ext3)
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 that
dev=/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
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
Are you sure there should not be lvreduce -L 80G system/home ?
Thanks!
D.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
10-29-2008, 12:49 PM
Luciano Rocha
resize LVM (ext3)
On Wed, Oct 29, 2008 at 01:38:06PM +0100, David Hláčik wrote:
> >
> >
> > Now, for lvresize:
> > lvresize -L 80G system/home
>
> Are you sure there should not be lvreduce -L 80G system/home ?
Same thing. I prefer the direction-neutral lvresize.
Regards,
Luciano Rocha
--
lfr
0/0
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
10-29-2008, 01:15 PM
"Filipe Brandenburger"
resize LVM (ext3)
Hi,
On Wed, Oct 29, 2008 at 07:58, David Hláčik <david@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 much
Reduce 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
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
10-29-2008, 01:24 PM
"William L. Maltby"
resize LVM (ext3)
On Wed, 2008-10-29 at 10:15 -0400, Filipe Brandenburger wrote:
> <snip>
> Reduce 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.
That's what I always do. It eliminates small chances of my math
disagreeing with resize2fs's math. Plus, IIRC, then the second re-size
doesn't need a size parameter. Resize2fs will automatically grow to the
maximum allowed by the partition/logvol.
>
> HTH,
> Filipe
> <snip sig stuff>
HTH
--
Bill
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
10-31-2008, 06:22 AM
"David Hláčik"
resize LVM (ext3)
Thanks guys for help!
Work is done, everything went fine ..
Have a nice day,
D.
On Wed, Oct 29, 2008 at 3:24 PM, William L. Maltby
<CentOS4Bill@triad.rr.com> wrote:
>
> On Wed, 2008-10-29 at 10:15 -0400, Filipe Brandenburger wrote:
>> <snip>
>
>> Reduce 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.
>
> That's what I always do. It eliminates small chances of my math
> disagreeing with resize2fs's math. Plus, IIRC, then the second re-size
> doesn't need a size parameter. Resize2fs will automatically grow to the
> maximum allowed by the partition/logvol.
>
>>
>> HTH,
>> Filipe
>> <snip sig stuff>
>
> HTH
> --
> Bill
>
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos