[linux-lvm] lvreduce nightmare
Bryn M. Reeves
bmr at redhat.com
Fri May 18 09:57:01 UTC 2012
-----BEGIN PGP SIGNED MESSAGE-----
On 05/16/2012 04:48 PM, tariq wali wrote:
> Filesystem Size Used Avail Use% Mounted
> on /dev/mapper/vg0-data 2.2T 1.7T 433G 80% /data
> Out of the available *433G* I wanted to reduce *100G* in vg0 so
> that I could use it for a new partition and this is what I did ..
> * e2fsck -f /dev/vg0/data resize2fs /dev/vg0/data 100G
This command will attempt to reduce the file system to 1OOG *total*.
It could not have succeeded given the file system state shown by df above.
> lvreduce -L -100G -n /dev/vg0/data*
This truncated the last 100G of the file system. Immediately stopping
at this point, restoring LVM metadata and fscking would have fixed this.
> *e2fsck -f /dev/vg0/data -n* * * after the fsck completed it would
> prompt to fix superblock/inodes which I replied with 'yes' however
> the problem still persists that if i mount /data it goes into
> read-only mode .
With -n the fsck should not write to the disk but if it was prompting
you for y/n to fixes then it probably was not run with that option.
> I have reduced lvm's with those sequence of commands in the past
> but i just dont understand why it seems to have failed this time
> although i did get 100G free space in vg0 but the partition /data
> seems useless ..
The resize2fs invocation used was incorrect and probably failed
causing the subsequent device resize to truncate the file system. The
fsck then trashed what was left while trying to fix it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the linux-lvm