LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This 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

Tags used in this thread
Popular LQ Tags ,

Reply
 
Thread Tools
Old 10-15-2009, 06:29 PM   #1
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora
Posts: 164
Thanked: 20
LVM2 on F10 - reduce LVM size and remove 2 HDDs


[Log in to get rid of this advertisement]
Hello all,

I have the following HDDs in an LVM2 configuration on an F10 box running Mythtv :-

# pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [297.88 GB / 0 free]
PV /dev/sdd1 VG VolGroup00 lvm2 [931.50 GB / 0 free]
PV /dev/sdb1 VG VolGroup00 lvm2 [298.06 GB / 0 free]
PV /dev/sdc1 VG VolGroup00 lvm2 [931.50 GB / 0 free]
Total: 4 [2.40 TB] / in use: 4 [2.40 TB] / in no VG: 0 [0 ]

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.
linux ArfaSmif is offline  
Tag This Post ,
Reply With Quote
Old 10-15-2009, 09:22 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 1,240
Thanked: 60
why?
windows_vista smeezekitty is offline     Reply With Quote
Old 10-15-2009, 09:38 PM   #3
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora
Posts: 164
Thanked: 20

Original Poster
Quote:
Originally Posted by smeezekitty View Post
why?
why what?
linux ArfaSmif is offline     Reply With Quote
Old 10-15-2009, 09:40 PM   #4
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 1,240
Thanked: 60
why remove space? you may need it in the future.
windows_vista smeezekitty is offline     Reply With Quote
Old 10-15-2009, 10:19 PM   #5
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora
Posts: 164
Thanked: 20

Original Poster
I appreciate your concern for my well being, but do you have anything to contribute about my LVM question?
linux ArfaSmif is offline     Reply With Quote
Old 10-15-2009, 10:59 PM   #6
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 1,240
Thanked: 60
i still dont see your logic but this may help
http://ubuntuforums.org/showthread.php?t=451605
windows_vista smeezekitty is offline     Reply With Quote
Old 10-16-2009, 05:34 AM   #7
GazL
Member
 
Registered: May 2008
Location: England.
Posts: 879
Thanked: 78
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.

Last edited by GazL; 10-16-2009 at 05:36 AM..
linux GazL is online now     Reply With Quote
Thanked by:
Old 10-16-2009, 10:20 PM   #8
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora
Posts: 164
Thanked: 20

Original Poster
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.
linux ArfaSmif is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to reduce lvm in size in RHEL5.0 kbklinux Linux - Software 1 05-14-2009 03:06 AM
How do you safely reduce a LVM partitions size? Igby Linux - Server 4 05-12-2009 12:41 AM
Difference between LVM and LVM2? your_shadow03 Linux - Newbie 2 05-08-2009 03:01 AM
[SOLVED] F10 Boot Problem - No LVM maxkukartsev Fedora 6 04-16-2009 12:07 AM
Reduce LVM Partition size without any data loss viral_Ahire Linux - Software 1 04-11-2008 04:42 PM


All times are GMT -5. The time now is 08:24 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration