LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-19-2006, 06:46 AM   #1
tomazN
Member
 
Registered: May 2005
Location: Slovenia
Distribution: Suse 10.2 64bit
Posts: 127

Rep: Reputation: 16
Removing a drive from LVM2 ...


I have a LVM2 with 5 disks. Now i want to remove one hdd, which is empty. But i cannot achive that for some reason. Here is what i tried:

vgdisplay:

--- Volume group ---
VG Name system
System ID
Format lvm2
Metadata Areas 5
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 5
Act PV 5
VG Size 1.36 TB
PE Size 4.00 MB
Total PE 357705
Alloc PE / Size 357705 / 1.36 TB
Free PE / Size 0 / 0
VG UUID RhX3Wr-PEC1-n8BA-2rMQ-iHwy-WvFr-1kVINF

/dev/hdi is the disk which i want to remove, was added last, so no data on it yet as this shows:

pvmove /dev/hdi:
No extents available for allocation

then i tried this:

vgreduce system /dev/hdi
Physical volume "/dev/hdi" still in use

So it doesnt want to remove it, saying its still in use ... I can`t figure it out from here on. Please help

I would try this also:

# umount /home
# resize2fs /dev/myvg/homevol 524288
# lvreduce -L-1G /dev/myvg/homevol
# mount /home

as suggested on some lvm2 page, but i don`t know how to get that number 524288 (blocks) i want to remove, so if hdd is 300GB how many blocks does it have, or even better where do i see this ? I probably have to resize the filesystem on my group before removing, but i dont know how to get that block size

Good day and thx.

Last edited by tomazN; 01-19-2006 at 06:49 AM.
 
Old 01-20-2006, 09:04 PM   #2
Notwerk
Member
 
Registered: Apr 2005
Location: Jordan
Distribution: Debian (Sarge), Ubuntu (6.06)
Posts: 271

Rep: Reputation: 30
That number should actually be the new size of the filesystem, NOT the size you wish to truncate. So if you're reducing the filesystem from 1.36 TB by 300 GB then the new size is 1.06 TB or 1060 GB.

So the line would be like:
#resize2fs /dev/myvg/homevol 1060G (you can use a "G" suffix to specify it in gigabytes)

Hope this helps
 
Old 01-20-2006, 10:20 PM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,023

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
I think when you run vgdisplay and it says:
Quote:
Free PE / Size 0 / 0
this means that your volume group is FULL, including /dev/hdi that is one of it's physical volumes.
Quote:
pvmove /dev/hdi:
No extents available for allocation
I read this as saying: "There's no space for me to move anything off of hdi, because the volume group it's part of is full".

I believe instead of being empty like you think, hdi is just the opposite - completely allocated.
Quote:
vgreduce system /dev/hdi
Physical volume "/dev/hdi" still in use
Further evidence that hdi is full, not empty.
 
Old 01-22-2006, 02:50 AM   #4
tomazN
Member
 
Registered: May 2005
Location: Slovenia
Distribution: Suse 10.2 64bit
Posts: 127

Original Poster
Rep: Reputation: 16
Hmm, not realy true. If i mount this volume group. It has about 450GB of free space left. And /dev/hdi was added last and after that nobody wrote to the hdd. So it should be empty. And other 3 full, and 4th hdd full like 60%. Dunno why it says it`s full.
 
Old 01-22-2006, 10:49 AM   #5
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,023

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by tomazN
Hmm, not realy true. If i mount this volume group. It has about 450GB of free space left. And /dev/hdi was added last and after that nobody wrote to the hdd. So it should be empty. And other 3 full, and 4th hdd full like 60%. Dunno why it says it`s full.
You don't mount volume groups, you mount logical volumes. Physical volumes are added to volume groups, and then the volume group is divided up into logical volumes which can be mounted. You may well have 450Gb of free space on some logical volume you created, but that 450Gb of space is still counted as "used" when talking about volume groups, and therefore the physical volumes that make up the volume group.

If there is a logical volume that is indeed unused, then you can unmount the filesystem using that logical volume, then delete the logical volume, and that MAY free up the space on your volume group to remove the physical volume hda1
 
Old 10-14-2009, 08:55 AM   #6
bksunday
LQ Newbie
 
Registered: Oct 2009
Posts: 1

Rep: Reputation: 0
moving data from drives in LVM

I know this thread is old but I feel the initial question and the answers doesn't match..


So, wouldn't some lvm tool be able move all hard drive's extents content to empty extents on other drives?

I mean, the pvmove commands move extents to another drive that does not have extents assigned to the volume. What we want is to be able to move extents content to other extents on another drive, and be able to unassign those empty extents on the drive we wish to remove!


Per say you have one 100G and one 20G hard drive.
all the extents available from both drive have all been assigned to our logical volume, and the total date used is 70G. How would you remove the 20G hdd to replace it with a bigger one? Can't you just make sure you have enough space to hold the data without that drive, then move all data in that 20G to the 100G, then remove the 20G from the group?


Bk.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Removing Hotplugged USB drive parados Suse/Novell 1 10-18-2004 11:56 AM
Removing Linux from a second hard drive jstroud99 Linux - General 2 09-13-2004 12:06 PM
After removing another hard drive, system sees incorrect amount of free space cellphone Linux - General 5 09-28-2003 07:29 PM
removing floppy drive jcue Linux - Newbie 1 08-14-2003 12:33 AM
Removing second hard drive undershepherd Linux - Hardware 5 05-16-2003 10:49 AM


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

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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration