Linux - GeneralThis forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
The system never uses more than about 250GB of HDD at any one time, so I would like to remove /dev/sdd1 and /dev/sdc1 from the LV and then from the machine and leave /dev/sda and /dev/sdb alone.
Does anyone know that if I use the command "system-config-lvm" to reduce the total LVM size to say 580GB, whether all data is preserved (I don't have any way at this stage to backup up 250GB of data, unless I buy more HDDs and that is the whole point of this exercise anyway - remove the two terrabyte drives to be used as backup disks).
Once I am happy that the data is safe, I will use "pvmove" and "vgreduce" to remove both terrabyte drives. Thanks in advance.
You've painted yourself into a bit of a corner by allocating all of your extents. You should be able to get around that, but it's a bit involved.
The following is just a guide. I expect you to look for any issues that may endanger your data (obviously, I can't see your system from here).
Unmount the filesystem you want to shrink.
Run fsck against it just to make sure it's in a good state.
Run resize2fs (I'm assuming ext2/3/4 here) to shrink your filesystem to a size slightly smaller than you want it to be (-16 or -32MB would probably be ok). Obviously, you can't shrink it smaller than the amount of data remaining in your filesystem, but make sure you shrink it enough to fit on the two remaining disks your system will have.
Run fsck again to make sure nothing bad happened.
Run lvreduce to reduce the size of the LV containing the filesystem to the size you would like it to be. Make sure the size is larger than that you used above on the resize2fs.
Run resize2fs again without specifying any size to allow your filesystem to grow to fill the exact size of the new lv.
Run fsck again to make sure nothing bad has happened.
mount your filesystem read-only, have a good look around at it.
Hopefully now you should have enough free extents in the volume group to migrate the logical volume off of the disks you wish to remove. 'pvmove' is the command to use.
Once you've got the PVs you wish to remove to be completely empty you can vgreduce them from the volume-group and remove them from your system.
Obviously, doing anything like this has to be considered high-risk, but it's either this or leave your 4 disks in there. You pays your money, you makes your choice.
Please remember, this is just a rough guide. It's your responsibility to make sure you fully understand what each command does at each step and that it is safe and makes sense on your system.
Hopefully, that gives you a starting point to work from. Best of luck.
Thanks GazL. I have done some more reading and found the LDP to be useful too (http://tldp.org/HOWTO/LVM-HOWTO/. It basically describes the same method as you have outlined. I will need to set aside a fair amount of time before I begin this task on a day when the box isn't recording any tv programmes.
I am still curious however, as to whether anyone has used the Redhat/Fedora "system-config-lvm" GUI successfully in a similar situation.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.