LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux lvm reducing problem (https://www.linuxquestions.org/questions/linux-newbie-8/linux-lvm-reducing-problem-4175416681/)

daud795 07-14-2012 07:31 AM

Linux lvm reducing problem
 
1 Attachment(s)
Hi!!!!!!!
To everyone

I am facing poblem to reduce the LINUX LVM size.

I have /dev/vg1/lv3 mounted under (/lvm).the size is 1GB and i want to reduce it 512MB.i am running like this:-

1- lvreduce -L -512M /dev/vg1/lv3
2- umount /lvm
3- resize2fs -f -p /dev/vg1/lv3 (i am also getting error on this command)

i am uploading the error through attachment.

Now my LVM Size is 512MB when i am seeing it through (lvdisplay)
But the problem is when i run (df -h) the size
is still (512MB)


help me my dears..

syg00 07-14-2012 07:42 AM

Very bad.
Step number 3 must be done first.

There is an LVM howto at tldp.org. I suspect you will need to restore from a backup, but you might be lucky - set the lv back to its original size and see if a fsck works. If so, do the resize2fs, then the lvreduce.
And hope.

whizzit 07-14-2012 11:15 AM

When shrinking a ext2/3 file system it is better to unmount it first. It is not explicitly stated in the resize2fs(8) man page but implied not to support on-line shrinking; only on-line extension.

+1 on syg00's comment.
  • Backup filesystem! There's no guarantee that data won't be lost - it is a high risk especially when shrinking.
  • Unmount filesystem
  • Shrink filesystem (resize2fs specifying the new size)
  • Shrink volume to a size equal or above the filesystem (lvreduce)

Another option that may recover the situation is by running the following (use -f if you need to) and after do a filesystem check:

Code:

resize2fs -p /dev/vg1/lv3 512M
By shrinking the volume first, part of the underlying filesystem has been destroyed. The only option might be to rebuild the filesystem, if syg00's idea of extending the volume again doesn't work.

Regards


All times are GMT -5. The time now is 04:17 PM.