LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux 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



Reply
 
Search this Thread
Old 09-30-2006, 07:27 PM   #1
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Rep: Reputation: 45
LVM: Wanting to remove a partition from a Volume Grou


I have a volume group Home, created as such

Code:
# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda14
  VG Name               Home
  PV Size               32.88 GB / not usable 0
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              8418
  Free PE               0
  Allocated PE          8418
  PV UUID               NfTX8K-nJG0-xvCx-jyCm-l8Qu-5Wgk-gV7hpV

  --- Physical volume ---
  PV Name               /dev/hdd8
  VG Name               Home
  PV Size               30.31 GB / not usable 0
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              7759
  Free PE               0
  Allocated PE          7759
  PV UUID               3gLP4u-jEPr-qN13-OFKZ-5rzB-kZlw-eb2zxH
Code:
# vgdisplay Home
  --- Volume group ---
  VG Name               Home
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               63.19 GB
  PE Size               4.00 MB
  Total PE              16177
  Alloc PE / Size       16177 / 63.19 GB
  Free  PE / Size       0 / 0
  VG UUID               K4JT4Q-I31s-eypt-RBm0-Sisb-3g4O-0h3hLO
Code:
# pvmove /dev/hdd8
  No extents available for allocation
Both partitions and the volume group are formatted as reiserfs. I want to remove /dev/hdd8 as being part of the volume group.

I assume that the pvmove means that there is no data hdd8. Is that a correct assumption? If yes then I will do the below.

I am thinking of booting of a Knoppix LiveCD and using vgreduce Home /dev/hdd8. I will probably try use chroot to make sure that the FC install is referenced as the root directory.
 
Old 09-30-2006, 08:00 PM   #2
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
You have a VG named "Home" that is made up of two PV's, /dev/sda14 (33Gb) and /dev/hdd8 (30Gb). VG "Home" is therefore 63Gb in size.

If you look at you pvdisplay and vgdisplay outputs, you'll see that everything is fully allocated (i.e., no more free space left). So you can't get rid of /dev/hdd8 because it's currently in use. You need to free it up before you can use vgreduce. That's what the pvmove command is for. To migrate data off of PV hdd8 to some other PV in it's same volume group.

But you have no room on the other PV in that group (sda14) to move anything on to, because sda14 fully allocated just like hdd8.

To get hdd8 out of there, first you will need to clear up lots of space. This can be done by deleting files and then using lvreduce or lvremove to get rid of the space taked by the LV's assigned to VG "Home". Provided you remove enough stuff from VG "Home" so that it would only require 33Gb of space total (not the 63Gb it now requires), then you can start pvmove'ing and vgreduce'ing.

Use df to find out how much space you're using from your LV's. Just because you may have an LV created with 30Gb of space doesn't mean that's all in use. You may be able to do some lvreduce'ing. You will need to shrink the filesystem(s) on the LV before you can use lvreduce. Luckily you used Reiser, which is shrinkable. Some other filesystem types are not shrinkable (XFS, JFS, etc.)

Reduce operations always scare me. You should run a complete backup before doing this.
 
Old 09-30-2006, 09:05 PM   #3
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
You see this is the thing that made me ask about LVM:

Here is the free space on Home: 64452MB of 64706MB free
 
Old 09-30-2006, 11:21 PM   #4
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by Jongi
Here is the free space on Home: 64452MB of 64706MB free
Yes. That is quite the waste of disk space. You have allocated 64Gb to /home, but you're only using 250Mb of that!

You're in luck. Everything you have under /home will easily fit on a CD. So backup is a no-brainer. I suggest you backup the entirity of /home to a CD. Fix your LVM, or delete it and start over, then restore /home from your backup CD. Since you'd have a solid backup of your /home to a CD, go ahead and play around to your heart's content with LVM. Resize your /home filesystem, then lvreduce, then pvmove, then vgreduce, etc. Just mess with it to learn all the steps and expose any pitfalls. If you totally destroy things in LVM, no matter ... you have a backup and can start over from scratch with LVM (if you want). Check out the LVM HowTo to learn about all the commands if you haven't already. http://tldp.org/HOWTO/LVM-HOWTO/

I'd certainly be interested in seeing your fdisk -l and cat /etc/fstab output. Not that it's relevent to your current problem. But with sda14 (FOURTEEN) and hdd8 (EIGHT) you've got to have a mess of partitions out there. Not to mention with hdd ("D") you've got to have a minor little disk farm attached (either that, or maybe a bunch of optical drives or other peripherals). I'd just be interested in seeing what you're doing with your system. Chances are you've got plenty of other disk space to backup 250Mb of /home without resorting to burning a CD (although I'd still go the CD route myself, for safety).
 
Old 10-02-2006, 03:56 AM   #5
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
Yeah I've basically set up the sda drive to house multiple distros. I've got another non-LVM partition available which I can backup the /home directory to.

The other option I thought of was (from the LVM HOWTO):

# resize_reiserfs -s-30.31G /dev/Home/lvol0
# lvreduce -L-30.31G /dev/Home/lvol0

then
# vgreduce Home /dev/hdd8
 
Old 10-02-2006, 07:22 AM   #6
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Sorry to barge in to learn something about LVM.

I have stayed away from LVM so that I can do whatever I wish with the partitions (got 60 and 57 partitions in my two IDE disks).

Looking at the problem reported here I wonder what benefit do we get ourselves into opting for LVM. I understand a LVM can link partitions across different disks but if we not not doing it what is the point of using it?

I know Grub (and possibly Lilo) has a problem of booting from a LVM because at the booting stage a boot loader has no access to a kernel and can't possibly go inside a LVM to find data to load. That limitation alone is an deterrent for users wanting to multiboot different systems. Have I got this wrong?

I ask the above question because it seems a user needs to do something extraordinary just to delete a partition.

Last edited by saikee; 10-02-2006 at 07:25 AM.
 
Old 10-02-2006, 11:38 AM   #7
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Sorry to barge in to learn something about LVM.
The mods are gonna get us for a hijack, so I emailed you with some of my thoughts on LVM. (From your profile, "Send a message via email to saikee".) It might be worthwhile for you to start a new thread "LVM? Why or why not?" or something to that effect. If you do, feel free to repost my email to that thread to start it off, if you'd like.
 
Old 10-02-2006, 12:09 PM   #8
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by Jongi
# resize_reiserfs -s-30.31G /dev/Home/lvol0
# lvreduce -L-30.31G /dev/Home/lvol0

then
# vgreduce Home /dev/hdd8
You may or may not need a pvmove before the vgreduce. vgreduce should inform you of that need, if it exists.
 
Old 10-05-2006, 11:24 AM   #9
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
Code:
[root:~#] resize_reiserfs -s-30.31G /dev/Home/lvol0
resize_reiserfs 3.6.19 (2003 www.namesys.com)


resizer_reiserfs: the new size value is wrong.
So I also tried this before that:

Code:
[root:~#] umount /home
umount: /home: device is busy
umount: /home: device is busy
So I guess I will most likely need a LiveCD that can handle LVM
 
Old 10-05-2006, 12:07 PM   #10
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
I can't comment on the Reiser resizing. I've only resized ext3 and xfs, and then, only to grow them, not shrink them.

Maybe I can help on the unmounting part though. I do not know whether Reiser wnats to be mounted or unmounted for resizing. I assume unmounted, because that's what you're trying to do here. I know ext3 needs to be unmounted to resize, but xfs and jfs are resized while they are mounted. I just don't know about Reiser. I assume you checked into that.

Whenever I'm doing my resizing, on my desktop system where I am the only user, I always drop down to single-user mode. That makes unmounting things much easier. Gets rid of all those other pesky user processes that cling to the filesystems making them hard to unmount (your "device is busy" errors).

Here's how I would resize a filesystem on my Debian computer. The steps should be similar on whatever distro you are using, but you may have to alter the final telinit command if your default multi-user runlevel is not 2 like mine. Also, your resize'ing and fsck'ing commands will be different for Reiser.
Code:
From Gnome, KDE, etc...
CTRL-ALT-F1 to grab a new virtual console
login: root
password: ...
# telinit 1  ( not very nice to other users, but since I'm the only one ... go ahead! )
# df -h /home
# umount /home
( the above should work, but if it's busy for some odd reason, try  umount -l /home )
( if you still have "busy" problems, find out why with  fuser -m /home | xargs ps -o'user,pid,cmd' -p or lsof /home )
# lvextend -L+1G /dev/vg_linux/home
# e2fsck -f /dev/vg_linux/home
# resize2fs /dev/vg_linux/home
# mount /home
# df -h /home
# telinit 2
 
Old 10-08-2006, 12:19 PM   #11
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
Regarding the resize_reiserfs command. Does that take only whole numbers? If that's the case and I issue the commands as follows:

resize_reiserfs -s -31G /dev/Home/lvol0
lvreduce -L-31G /dev/Home/lvol0
vgreduce Home /dev/hdd8

Should that work?

Last edited by Jongi; 10-08-2006 at 12:21 PM.
 
Old 10-08-2006, 02:49 PM   #12
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
So I did what I last posted.

Then I did:

Code:
# mkfs.reiserfs /dev/hdd8
# pvcreate /dev/hdd8
# vgextend Store /dev/hdd8
# lvextend -L +30.31G /dev/Store/lvol0 (I actually added incremently until it amounted to 30.31GB)
Now this is where my system is at:

Code:
[root:~#] cat /etc/fstab | grep Store
/dev/Store/lvol0        /mnt/Store              reiserfs defaults        1 2
[root:~#] df -h /mnt/Store/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/Store-lvol0
                       31G   30G  1.6G  95% /mnt/Store
[root:~#] pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda14
  VG Name               Home
  PV Size               32.88 GB / not usable 0
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              8418
  Free PE               177
  Allocated PE          8241
  PV UUID               NfTX8K-nJG0-xvCx-jyCm-l8Qu-5Wgk-gV7hpV

  --- Physical volume ---
  PV Name               /dev/sda13
  VG Name               Store
  PV Size               30.00 GB / not usable 0
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              7679
  Free PE               0
  Allocated PE          7679
  PV UUID               OV6q8V-UWgF-TCgn-n5Nh-gtza-Kk6i-T2ahtt

  --- Physical volume ---
  PV Name               /dev/hdd8
  VG Name               Store
  PV Size               30.31 GB / not usable 0
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              7759
  Free PE               0
  Allocated PE          7759
  PV UUID               8pWwhL-agyR-8lb8-07vj-BZHo-HOlN-JzNtjN

  --- Physical volume ---
  PV Name               /dev/sda12
  VG Name               Games
  PV Size               39.99 GB / not usable 0
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              10238
  Free PE               0
  Allocated PE          10238
  PV UUID               BIr2Bf-E1Fd-CcId-NoZY-1c4A-o74M-mgbPz4
[root:~#] lvdisplay
  --- Logical volume ---
  LV Name                /dev/Home/lvol0
  VG Name                Home
  LV UUID                QrIb5n-XkLB-OSdC-4arw-ko73-y61b-7Hv7zs
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                32.19 GB
  Current LE             8241
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/Store/lvol0
  VG Name                Store
  LV UUID                FOiqSr-Ld44-pAdD-CjUh-fwnL-erzd-VV6NnP
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                60.30 GB
  Current LE             15438
  Segments               2
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:1

  --- Logical volume ---
  LV Name                /dev/Games/lvol0
  VG Name                Games
  LV UUID                tXUGRf-alNS-NMmC-pIc0-RJbk-DbsE-sGku2x
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                39.99 GB
  Current LE             10238
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:2
How do I get df to show the balance free to 60.3GB?

Last edited by Jongi; 10-08-2006 at 02:51 PM.
 
Old 10-08-2006, 03:41 PM   #13
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
I hadn't resized the partition so the below did the trick

# resize_reiserfs -f /dev/Store/lvol0

Which now gives:

Code:
[jongi:~#] df -h /mnt/Store/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/Store-lvol0
                       61G   30G   31G  49% /mnt/Store
I ran all the command line instructions from Kubuntu Dapper 64-bit.

EDIT: My only concern now (and it is a small one) is that free 708MB under Home.

Last edited by Jongi; 10-08-2006 at 03:55 PM.
 
Old 11-01-2006, 02:43 PM   #14
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
I can't remember now but I think I solved the last issue by running:

# pvextend -l +177 Home /dev/Home/lvol0
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM migration to regular volume Delta-9 Fedora 18 08-24-2006 01:25 AM
How to mount LVM Volume twice Phil.Johnson Linux - Software 0 03-14-2006 12:17 PM
Can I delete LVM Volume Groups? second_existence Linux - Newbie 1 01-24-2006 11:20 PM
LVM Physical Volume Lucky_Sevin Linux - Software 2 01-10-2006 11:44 AM
LVM volume mounting trouble SergeyAC Linux - Software 3 04-11-2005 02:28 PM


All times are GMT -5. The time now is 11:40 AM.

Main Menu
Advertisement
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