[linux-lvm] lvreduce nightmare

tariq wali ganaiwali at gmail.com
Fri May 18 14:13:40 UTC 2012


Appreciate the response although I realized a messed up large volume  lvm
requires time and which I didn't have in this case and resorted to backup
and recreated volumes all over new .

I realize I went wrong with resize2fs thinking that it would reduce my lvm
by 100G but it actually reduced the total volume size to 100G , i-e an lvm
of 1.7T

resize2fs /dev/vg0/data 100G ( i thought it would reduce the by 100G but
dropped the block device size to total of 100G )

so to i guess to do this right i should have

resize2fs /dev/vg0/data 1.6T or (1600G)

and then lvreduce -n data -L 100G /dev/vg0/data ( to reduce the lvm by 100
)

I even tried the vgcfgrestore on the archived lvm metadata file but that
just restored the metadata (back to original volume size however I still
had a bad file system ) .


Tariq


On Fri, May 18, 2012 at 3:55 PM, Bryn M. Reeves <bmr at redhat.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 05/18/2012 12:13 AM, Ray Morris wrote:
> > Stop. Don't do anything else until you are sure of what to do next.
> >  You will not lose data by studying. You can lose data by trying to
> > fix it.
> >
> >> resize2fs /dev/vg0/data 100G lvreduce -L -100G -n /dev/vg0/data*
> >
> > A 100 GB filesystem needs a block device of around 110 GB.  So
> > this cut off the end of your filesystem. (The device needs to hold
> > the journal as well as the FS, for example.)
>
> Not with most file systems. When you ask resize2fs to make a file
> system 100G it will make it (within rounding limits) 100G's worth of
> blocks in length. This is the actual space required on the disk (i.e.
> the argument is the size of the file system image not the maximum free
> space within it).
>
> E.g.:
>
> # lvcreate -L 100M -n l0 tvg0
>  Logical volume "l0" created
> # mke2fs -j /dev/tvg0/l0
> mke2fs 1.41.9 (22-Aug-2009)
> Filesystem label=
> OS type: Linux
> Block size=1024 (log=0)
> Fragment size=1024 (log=0)
> 25688 inodes, 102400 blocks
> [...]
>
> 102400 1024-byte blocks is exactly 100M (MiB to be pedantic).
>
> Resize to 50M gives:
>
> # resize2fs /dev/tvg0/l0 50M
> resize2fs 1.41.9 (22-Aug-2009)
> Resizing the filesystem on /dev/tvg0/l0 to 51200 (1k) blocks.
> The filesystem on /dev/tvg0/l0 is now 51200 blocks long.
>
> 51200 1024 byte blocks is exactly 50MiB.
>
> Regards,
> Bryn.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk+2I6wACgkQ6YSQoMYUY96SlACfTAzVIzeym6iM3fzGhsR0P9YK
> iG8Amwfu9AwTnwHvCUddMdzhKxlW0uCA
> =+ITm
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm at redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>



-- 
*Tariq Wali.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20120518/9ed81129/attachment.htm>


More information about the linux-lvm mailing list