PDA

View Full Version : Can't use gparted on LVM2 filesystem?



nick623
8th September 2007, 07:08 AM
I currently have FC5 and am planning on installing FC7 from the live cd. I was hoping that I could create a new /home partition to save my files by using gparted from a live cd in my case Ubuntu 7.04. But apparantly as I've discovered trying gparted from the live cd it doesn't recognise a LVM filesystem.

I've just started googling about LVM and it's pretty heavy. Does anybody no of a partition tool that will work the LVM filesystem?

Thanks.

Any advice or links to help would be appreciated.

nick623
10th September 2007, 02:02 AM
Bump

I'm googling on the subject.
It's a long process.

Still would appreciate any good advice.

Dan
10th September 2007, 02:35 AM
Hi Nick.

Rather than bumping, you can post with the progress you've made so far. Bumping is generally frowned upon. <..:)..>


Dan

nick623
10th September 2007, 02:55 AM
Well so far no progress.
I'm trying to learn a little more about LVM.
And I've messed around with fdisk on a flash drive to have to "wet my feet."

I am quite the newbie on partitioning anything.

Anyway still researching.

stoat
10th September 2007, 03:01 AM
Does anybody no of a partition tool that will work the LVM filesystem?Hello nick623,

I think you just made part of the case against using LVM. I decided that it is not for me for similar reasons. When everything is humming along, you can't even tell it's there. When there's trouble or something like this comes up, most of us don't know what to do. I think the LVM concept is wonderful for what it was intended. But I don't see the advantage for an ordinary home computer. The additional layer of complexity to learn and understand is not worth the benefit for me. And it could easily take a newbie with enough to worry about already and plow them under the dirt.

Anyway, back to you. First, consider not using LVM in your new system. Second, what about keeping your FC5 system at least for a while and installing the new F7 alongside it while you get used to it? Just transfer the files you are concerned about to the new system.

bob
10th September 2007, 03:18 AM
Hmmm...wonder if Disk Druid would be the solution, since it's used to set up LVM in Fedora: (Edit: removed link to phony "free" software site)

nick623
10th September 2007, 03:18 AM
I appreciate the quick response.
But I have a question. If the default Fedora installation is to us the LVM management filesystem. Is the only way for me to lose the whole LVM thing is to chose not the default but to choose to manually partition the disk.

I'm tempted to say 'F**K it" and go with the default Fedora installation. But I am willing to learn.

nick623
10th September 2007, 03:34 AM
I appreciate the response Bob. It looks to me that I'm could use a command line tool such as fdiisk or parted.
Ok. I can do that. But the whole beauty of using Gparted or another Live CD is that the root file system is umounted(rightfully so). As you can tell I have no experience on partitioning.

Ok I guess my big question is if I have a LVM2 filesystem mounted somewhere. Is there a way I can create a new /home partition on that root partition for a new Fedora 7 install?

I'm trying.

bob
10th September 2007, 03:53 AM
Not that I know of, within the LVM. How about simply backing up /home to DVD, another drive, pen drive or something like that? Then just paste the data into your new install? That's how I do it with my 8 distros.

nick623
10th September 2007, 04:52 AM
I don't live in the real wolrd. And I have two old computers with no read/write dvd or cd drives.
So backing up the /home partition is not a realistic option.
Yeah, I like living in the '80s.

The input is apreciated.

Thanks.

wintermute000
10th September 2007, 06:59 AM
well mate if your computers are old, the HDDs can't be too big. And USB drives are getting mighty cheap.... you could probably get an external HDD for under 100 USD that will more than comfortably fit your entire /home, works in Fedora via USB out of the box.

markkuk
10th September 2007, 08:11 AM
But I have a question. If the default Fedora installation is to us the LVM management filesystem.
LVM is not a filesystem, that's one of the first things you must understand when dealing with LVM. It's a virtualization layer for hard disk storage. Gparted, parted, fdisk or other tools for physical partitioning can't handle LVM, you must use the graphical system-config-lvm tool or the command-line LVM programs.


Ok I guess my big question is if I have a LVM2 filesystem mounted somewhere. Is there a way I can create a new /home partition on that root partition for a new Fedora 7 install?
Yes, first shrink the / logical volume: http://forums.fedoraforum.org/showthread.php?t=154874
Next, create a new logical volume for /home.

kirios
10th September 2007, 08:36 AM
I think the LVM concept is wonderful for what it was intended. But I don't see the advantage for an ordinary home computer.
What are the advantages of LVM? I installed Fedora 7 with separate partitions for / and swap but am now wondering whether I missed out on a good thing.

wintermute000
10th September 2007, 09:24 AM
say you can have a single 'virtual' partition across two real hard disks.

kirios
10th September 2007, 04:51 PM
say you can have a single 'virtual' partition across two real hard disks.
That's pretty cool!


first shrink the / logical volume: http://forums.fedoraforum.org/showthread.php?t=154874
Next, create a new logical volume for /home.
So the new /home would be on a different (physical) partition?

Dan
10th September 2007, 04:59 PM
... What are the advantages of LVM? ...

This is strictly one man's opinion, so please take it as such ... but I've found, for me, and perhaps for the average home user, LVM is almost as useful as a double-action automatic pistol. It's a damn fine solution ... to a non-existent problem!


Dan

SlowJet
10th September 2007, 05:30 PM
That's pretty cool!


So the new /home would be on a different (physical) partition?


TA-DAAAAAAA, he finally saw the light! regular or disk druid decafe (like mine.)
# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup71 1 2 0 wz--n- 74.00G 32.00M
VolGroup72 1 2 0 wz--n- 465.75G 32.00M
[root@Ruthie-07 ~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
LogVol71root VolGroup71 -wi-ao 69.97G
LogVol71swap VolGroup71 -wi-ao 4.00G
LogVol72home VolGroup72 -wi-ao 461.72G
LogVol72swap VolGroup72 -wi-ao 4.00G


SJ

nick623
10th September 2007, 09:04 PM
Ok I'm using this link http://forums.fedoraforum.org/showthread.php?t=154874 given to me in this post. In rescue mode after umounting all the relevant files under /mnt/sysimage I'm stumped when I try to umount /mnt/sysimage I get the error message: "Device or resource busy".

I tried the umount -l command several times as recommended in the link with no success.
I even tried umount -f but got message that option to umount apparantly is not available in this limed shell in rescue mode.
There is always got to be a catch.

Well that's where I'm stuck right now. Anybody have any ideas?

Thanks

I also tried fuser -km /mnt/sysimage and then umount /mnt/sysimage still same message.

markkuk
10th September 2007, 09:48 PM
Use "mount" or "cat /proc/mounts" to see that there isn't anything mounted under /mnt/sysimage. Use "pwd" to check that your current directory isn't in /mnt/sysimage.

nick623
10th September 2007, 10:17 PM
Ok I'm in rescue mode and tried mount command. It shows that:
/dev/VolGroup00/LogVol00 on /mnt/sysimage type ext3 (ro,data=ordered)

So do I need to umount /dev/VolGroup00/LogVol00?

I tried umount /dev/VolGroup00/LogVol00 I get: umount: /dev/mapper/VolGroup00-LogVol00: Invalid argument.

The pwd command gives me /tmp.

Any ideas what I'm doing wrong.

markkuk
10th September 2007, 10:40 PM
umount -l /mnt/sysimage should work. What's the exact error message you get?

nick623
10th September 2007, 11:11 PM
The message is: "umount: Device or resource busy".

Nothing I try works. It seems this should be pretty straightfoward to figure out.
But I can't.

wintermute000
11th September 2007, 12:02 AM
try umount -l

make sure nothing is using that device or partition (programs running in background? etc.)

maybe the lsof command can help too.

nick623
11th September 2007, 12:30 AM
Well I've tried umount -l /mnt/sysimage till my fingers bleed.
As for lsof I tried lsof /mnt/sysimage and got no processes except lsof.
Maybe there are other options to lsof?
Or maybe another way to figure what device is using /mnt/sysimage?

This really getting old.

Is there another way I can shrink my root partition to create a seperate /home logical volume?
Perhaps using a live CD?

SlowJet
11th September 2007, 02:12 AM
You don't want to do the /mnt/sysimage and chroot to work on the system OS.
You just want to activate the VG.
logoned on as root (should be default)
vgs
vgchange -a y VolGroup00
vgs
lvs
displayvg
displaylv


Now you are ready to use LVM and ext2progs tools to work on the / and create a /home.
This may work better with the live CD. It would have the full tool set and the gui LVM tool that does multiple command at at once.

I don't remember the command name but the sequence is.

1. reduce / f/s - resizefsext. (round to an LVM extent 32MB - see displaylv and vg for number and size)
2. Lvreduce - see man lvreduce
3. lvcreate (create the lv for a new /home, i.e. vl07) - see man lvcreate
4. format new lv as ext3 - see man ext2fs

cd /mnt
mkdir /mnt/myslash
mkdir /mnt/mynewhomw

Now mount the smaller /
mount /dev/mapper/Vg00-Lv01 /mnt/myslash
mount the new home lv
mount /dev/mapper/vg00-LV07 /mnt/mynewhome

cd /mnt/myslash/
cp /home/* /mnt/mynewhome/
check it out
cd /
rename /home to /oldhome

You will need to ensure chown and settings with a SELinux relabel or fizfiles (man fixfiles.)
You will need to edit fstab for a sep mount for home pointing to vg00-lv7
when all is good you can deal with /oldhome

This is example only, do not copy/paste.

SJ

nick623
11th September 2007, 02:54 AM
Wow slowjet that's a lot of info unloaded at once.
Does the root filesytem need to be umounted to do this(should I use a live cd for eg.)
What exactly do you mean by activate VG?

I'm kind of lost on all that.

nick623
12th September 2007, 01:44 AM
Ok Slowjet I've been doing alot of googling and am starting to understand alot of what your saying.

Here is what i get using the df -h command:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
14G 7.1G 5.3G 58% /
/dev/hda1 99M 19M 75M 21% /boot
tmpfs 189M 0 189M 0% /dev/shm

I want to shrink my root partition by 3G for room for a home partition.
The commands I want to type are:
# lvm vgscan
# lvm vgchange -ay
# e2fsck -f /dev/VolGroup00/LogVol00
#lvreduce -L 3G /dev/VolGroup00/LogVol00

Once I boot up in rescue mode I choose to not mount any partitions.
I then typed the following commands:

# lvm vgscan
# lvm vgchange -ay
# e2fsck -f /dev/VolGroup00/LogVol00
# resize2fs -f /dev/VolGroup00/LogVol00 3G

Then I get the following error message: "resize2fs: No space left on device while tring to resize /dev/VolGroup00/LogVol00"

I guess I'm missing something 'df -h' tells me I have 5.3G available.

I read somewhere that if I receive this message the new size is too large for the existing allocation tables.
What allocation tables?
And what commands do I use to view the allocation table.

Next question when I install FC7 and option to create partition comes up.
If I create a new home partition will it default to LVM or can I use standard ext3 file system so in the future I don't have to go through this nightmare again.

markkuk
12th September 2007, 07:47 AM
Here is what i get using the df -h command:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
14G 7.1G 5.3G 58% /

# lvm vgscan
# lvm vgchange -ay
# e2fsck -f /dev/VolGroup00/LogVol00
# resize2fs -f /dev/VolGroup00/LogVol00 3G

Then I get the following error message: "resize2fs: No space left on device while tring to resize /dev/VolGroup00/LogVol00"

I guess I'm missing something 'df -h' tells me I have 5.3G available.
You are trying to set the size of the fs to 3G, not shrinking it by 3G. You have 7.1G used, so obviously that won't fit into a 3G filesystem size. Try "resize2fs -f /dev/VolGroup00/LogVol00 11G" instead.

nick623
12th September 2007, 02:10 PM
You are trying to set the size of the fs to 3G, not shrinking it by 3G. You have 7.1G used, so obviously that won't fit into a 3G filesystem size. Try "resize2fs -f /dev/VolGroup00/LogVol00 11G" instead.

God. I feel really stupid.
Thanks markkuk. I thought it was probably some stupid mistake on my part.

I will try this when I get back from work later today.

nick623
13th September 2007, 02:58 AM
Ok I also passed 11G as the argument to the lvreduce command like this:
lvreduce -L 11G /dev/VolGroup00/LogVol00

I hope that was correct
The df-h command shows the following:
Size Used Avail Use%
/dev/mapper/VolGroup00-LogVol00
11G 7.1G 3.1G 71

So now I need to create a new logical volume for the /home directory.
So if I want a 3G /home logical volume do I just issue the command:
#lvrcreate -L3G -n home/dev/VolGroup00/LogVol00
And then add filesystem:
#mkfs -t ext3 -L home /dev/VolGroup00/LogVol00
And then go thru mounting episode.

Am I on the right track?
I am a perpetual newbie.

nick623
14th September 2007, 06:32 PM
Well after nearly a week of being chained to my computer I finally created a home logical volume on the the root volume copying my old /home directory to the new partition. Whew!

Definitely learned a few more things.

I have some questions though.
When I go ahead and finally install Fedora 7 will it automatically recognize my new home logical partition or is there something(God forbid) that have to manually do during installation?

And why couldn't I just create a new logical volume using the lvcreate command without the lvreduce command during rescue mode.

I'm still kind of confused about the partitioning shrinking and resizing thing.

Oh well that's it for now.

SlowJet
15th September 2007, 03:13 AM
I had no doubt you would figure it out.
You should be very happy with yourself.

The lvreduce is for the LogVol00's extents. (32 MB each), so the VG would have free space (extents) to create a new LV.

When you install or upgrade your system you only need to select the VG (scroll up on disk druids partitions window to select LVM parts) and click edit, select the LV in the lower pane, and finally supply mount point and format for / but do not format for /home unless you want to do a completely new install.

And /boot is alway a regular partition as ext3.

Good Job,

SJ

nick623
15th September 2007, 04:39 AM
I had no doubt you would figure it out.
You should be very happy with yourself.

The lvreduce is for the LogVol00's extents. (32 MB each), so the VG would have free space (extents) to create a new LV.

When you install or upgrade your system you only need to select the VG (scroll up on disk druids partitions window to select LVM parts) and click edit, select the LV in the lower pane, and finally supply mount point and format for / but do not format for /home unless you want to do a completely new install.

And /boot is alway a regular partition as ext3.

Good Job,

SJ
Thanks Slowjet the learning curve was pretty steep for me.
Do you know of any links on LVM partitioning, particularly during the installation process that might have snapshots of what I might expect to see when using Disk Druid. Since the only apparent time I will come across it is during the installation process.

Thanks for your helpful information. You really steered me in the right direction.

markkuk
15th September 2007, 08:25 AM
Do you know of any links on LVM partitioning, particularly during the installation process that might have snapshots of what I might expect to see when using Disk Druid.
See the RHEL Deployment Guide: http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Deployment_Guide-en-US/s1-lvm-diskdruid-manual.html
Red Hat has also a complete LVM Administrator's Guide (http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Cluster_Logical_Volume_Manager/index.html)