PDA

View Full Version : how to get lvm disks to work?



sireasoning
01-18-2003, 11:23 AM
I have a hard drive which uses lvm. Unfortunately, Knoppix just mounts the lvm partition as say /dev/hdc (which is useless). How can I get the system to show my lvm logical volumes (similar to partitions) and mount them?

sireasoning
01-18-2003, 11:24 AM
for those who don't know lvm = logical volume management

Dave_Bechtel
01-19-2003, 05:59 AM
--You could try ' apt-get install lvm2 '... Let me know if/how you get it working, I'm still using SuSE 7.3 (triple-boot) for my LVM stuff. Yast has a really decent frontend for it.


I have a hard drive which uses lvm. Unfortunately, Knoppix just mounts the lvm partition as say /dev/hdc (which is useless). How can I get the system to show my lvm logical volumes (similar to partitions) and mount them?

sireasoning
01-19-2003, 08:41 AM
lvm is already part of the distribution (at least it appears to be). Unfortunately it is not setup to recognize lvm drives automatically at bootup so I was wondering if anyone had worked with knoppix and lvm before.

I might just init 2 then try
vgscan && vgchange -a y
which is how it is started in the /etc/rc.d/rc.sysinit script in Mandrake 8.2
However in the rc.sysinit script it is run before the swapfile is activated and I fear that the mounted drive (read-only) which contains the lvm partition and the mounted (read-only) drive that contains /etc/lvmtab may not be able to effectively talk to each other.

has anyone gotten their lvm partitions up in knoppix?

Dave_Bechtel
01-20-2003, 05:24 AM
--I dunno if that alone will work; I think the /dev files have to be created / re-created somehow. You could try using mc to copy the /dev files for lvm from MDK over to Knoppix, and then do the cmds.

--Knoppix mounts individual partitions r/o, not entire drives... If you run the lvm cmds manually, it should mount the lvm drives r/w. As far as /etc/lvmtab goes, I dunno if it would be better just to do a HD install rather than trying everything from CD.

--Best of luck tho.

===========


lvm is already part of the distribution (at least it appears to be). Unfortunately it is not setup to recognize lvm drives automatically at bootup so I was wondering if anyone had worked with knoppix and lvm before.

I might just init 2 then try vgscan && vgchange -a y
which is how it is started in the /etc/rc.d/rc.sysinit script in Mandrake 8.2
However in the rc.sysinit script it is run before the swapfile is activated and I fear that the mounted drive (read-only) which contains the lvm partition and the mounted (read-only) drive that contains /etc/lvmtab may not be able to effectively talk to each other.

has anyone gotten their lvm partitions up in knoppix?

sireasoning
01-21-2003, 04:41 AM
I got it to work but it was quite convaluted.

Here is what I did:

- as root
vgscan && vgchange -a y
(this scans for the lvm partitions and then activates them)

my lvm group is named mandrake and I have 6 volumes (partitions) named 1 2 3 4 5 6
Knoppix correctly created a /dev/mandrake with these 6 volumes.

Next I created the directories to hold them
mkdir /mnt/mandrake1
etc
so I then went into /etc/fstab and added these 6 partitions
/dev/mandrake/1 /mnt/mandrake1 auto noauto,users,exec 0 0
etc...

Afterwards I went into kde and from the desktop right clicked and chose
Create New, hard disk
and then filled in the info and made them read only (a little extra precaution since most cannot be written to except as root). If I did want to write to them I would then go to properties for that hard drive icon and click off read-only. It would be nice to have a way to have them auto created with Knoppix's extra menu option (to switch back and forth from read only)

I guess my main question is... since lvm is already included in the distro and it seems to work properly, why not make it part of the bootup/shutdown configuration?

Dave_Bechtel
01-22-2003, 04:33 PM
--I think the /mnt/mandrake1 ... 6 part is incorrect. True LVM gets mounted on only 1 directory (mount point.)

--Try ' ls -l /dev/mandrake ' and see what's in there. On the SuSE side, my LVM is mounted as:



/dev/extralvm/extralvm /mnt/extra reiserfs defaults,noatime,noexec,notail,rw 0 0
/dev/scsilvm/scsilvm /mnt/scsibkps reiserfs defaults,noauto,noatime,noexec,rw 0 0


--As you can see, multiple partitions are mounted under 1 mount point. I think if you try to write to (say) /mnt/mandrake2, it could cause data corruption.



--Note that the LVM partition TYPE must also be 8e:
/dev/hdc4 449 4849 17744832 8e Linux LVM
/dev/hda6 420 611 1542208+ 8e Linux LVM


--All you should need is (say) /mnt/mandrakelvm, instead of 1-6.


I got it to work but it was quite convaluted.

Here is what I did:

- as root
vgscan && vgchange -a y
(this scans for the lvm partitions and then activates them)

my lvm group is named mandrake and I have 6 volumes (partitions) named 1 2 3 4 5 6
Knoppix correctly created a /dev/mandrake with these 6 volumes.

Next I created the directories to hold them
mkdir /mnt/mandrake1
etc
so I then went into /etc/fstab and added these 6 partitions
/dev/mandrake/1 /mnt/mandrake1 auto noauto,users,exec 0 0
etc...

Afterwards I went into kde and from the desktop right clicked and chose
Create New, hard disk
and then filled in the info and made them read only (a little extra precaution since most cannot be written to except as root). If I did want to write to them I would then go to properties for that hard drive icon and click off read-only. It would be nice to have a way to have them auto created with Knoppix's extra menu option (to switch back and forth from read only)

I guess my main question is... since lvm is already included in the distro and it seems to work properly, why not make it part of the bootup/shutdown configuration?

sireasoning
01-24-2003, 07:50 AM
$ ls -l /dev/mandrake
total 0
brw-rw---- 1 root disk 58, 0 Jan 23 04:06 1
brw-rw---- 1 root disk 58, 1 Jan 23 04:06 2
brw-rw---- 1 root disk 58, 2 Jan 23 04:06 3
brw-rw---- 1 root disk 58, 3 Jan 23 04:06 4
brw-rw---- 1 root disk 58, 4 Jan 23 04:06 5
brw-rw---- 1 root disk 58, 5 Jan 23 04:06 6
crw-r----- 1 root disk 109, 0 Jan 23 04:06 group

This was created through the Mandrake 8.2 gui.

Next I rebuilt /etc/fstab:
none /proc proc defaults 0 0
none /dev/pts devpts mode=0622 0 0
/dev/fd0 /mnt/auto/floppy auto user,noauto,exec,umask=000 0 0
/dev/cdrom /mnt/auto/cdrom auto user,noauto,exec,ro 0 0
/dev/cdrom1 /mnt/auto/cdrom1 auto users,noauto,exec,ro 0 0
# Added by KNOPPIX
/dev/hda1 /mnt/hda1 ext3 noauto,users,exec 0 0
#rebuild mandrake at /home/knoppix/mnt
/dev/hda6 /home/knoppix/mnt/ ext3 noatime 1 1
/dev/hda5 /home/knoppix/mnt/boot ext2 noatime 1 2
/dev/mandrake/3 /home/knoppix/mnt/home reiserfs noatime,notail 1 2
/dev/mandrake/6 /home/knoppix/mnt/mnt/shared ext3 noatime 1 2
/dev/mandrake/4 /home/knoppix/mnt/opt ext3 noatime 1 2
/dev/mandrake/1 /home/knoppix/mnt/usr xfs noatime 1 2
/dev/mandrake/2 /home/knoppix/mnt/var xfs noatime 1 2
/dev/mandrake/5 /home/knoppix/mnt/var/spool ext3 noatime 1 2

Then I created a couple of scripts in /home/knoppix, .lvmon and .lvmoff (I had to make them dot files so saveconfig would save them):

.lvmon:
sudo vgscan && sudo vgchange -a y
mkdir /home/knoppix/mnt
sudo mount /dev/hda6
sudo mount /dev/hda5
sudo mount /dev/mandrake/3
sudo mount /dev/mandrake/6
sudo mount /dev/mandrake/4
sudo mount /dev/mandrake/1
sudo mount /dev/mandrake/2
sudo mount /dev/mandrake/5

.lvmoff
sudo umount /dev/mandrake/5
sudo umount /dev/mandrake/2
sudo umount /dev/mandrake/1
sudo umount /dev/mandrake/4
sudo umount /dev/mandrake/6
sudo umount /dev/mandrake/3
sudo umount /dev/hda5
sudo umount /dev/hda6
sudo vgchange -a n

I have found that if I forget to do .lvmoff that it still seems to work ok the next bootup (all volumes are unmounted during halt but no "vgchange -a n" is run as far as I know.

It would be nice if it could do something like this automatically without me having to manually rebuild like I did. Is lvm smart enough to do that? Is there a magic file that would rebuild /etc/fstab automagically, then properly mount it in the proper order?

Also, now that I have my mandrake tree, is there a way to have knoppix recognize my libs, etc? I have tried to run programs that I have on mandrake through knoppix, but most fail because it could not find the proper .so files or libs.

Dave_Bechtel
01-24-2003, 07:52 PM
--Hmmmm... This appears to be a different LVM than what I'm using. I have multiple physical drives LVM'ed into one mount point:

ls /dev/scsilvm -l
total 0
crw-r----- 1 root disk 109, 1 Dec 6 12:37 group
brw-rw---- 1 root disk 58, 1 Dec 6 12:37 scsilvm
dave:~> ls /dev/extralvm -l
total 0
brw-rw---- 1 root disk 58, 0 Dec 6 12:37 extralvm
crw-r----- 1 root disk 109, 0 Dec 6 12:37 group

--To save yourself some code, you could try (at least for the umount)
' sudo umount /dev/mandrake/? '

>> Also, now that I have my mandrake tree, is there a way to have knoppix recognize my libs, etc? I have tried to run programs that I have on mandrake through knoppix, but most fail because it could not find the proper .so files or libs.

--Mount your Mandrake root partition and chroot to it.
' mkdir /mnt/mdkroot '
' mount /dev/hdaX /mnt/mdkroot '
' chroot /mnt/mdkroot '

--You may have to mount things again inside, once you're chrooted. BTW, the chroot only works for the 1 VT (virtual-terminal) that you issued the command in.


$ ls -l /dev/mandrake
total 0
brw-rw---- 1 root disk 58, 0 Jan 23 04:06 1
brw-rw---- 1 root disk 58, 1 Jan 23 04:06 2
brw-rw---- 1 root disk 58, 2 Jan 23 04:06 3
brw-rw---- 1 root disk 58, 3 Jan 23 04:06 4
brw-rw---- 1 root disk 58, 4 Jan 23 04:06 5
brw-rw---- 1 root disk 58, 5 Jan 23 04:06 6
crw-r----- 1 root disk 109, 0 Jan 23 04:06 group

This was created through the Mandrake 8.2 gui.

Next I rebuilt /etc/fstab:
none /proc proc defaults 0 0
none /dev/pts devpts mode=0622 0 0
/dev/fd0 /mnt/auto/floppy auto user,noauto,exec,umask=000 0 0
/dev/cdrom /mnt/auto/cdrom auto user,noauto,exec,ro 0 0
/dev/cdrom1 /mnt/auto/cdrom1 auto users,noauto,exec,ro 0 0
# Added by KNOPPIX
/dev/hda1 /mnt/hda1 ext3 noauto,users,exec 0 0
#rebuild mandrake at /home/knoppix/mnt
/dev/hda6 /home/knoppix/mnt/ ext3 noatime 1 1
/dev/hda5 /home/knoppix/mnt/boot ext2 noatime 1 2
/dev/mandrake/3 /home/knoppix/mnt/home reiserfs noatime,notail 1 2
/dev/mandrake/6 /home/knoppix/mnt/mnt/shared ext3 noatime 1 2
/dev/mandrake/4 /home/knoppix/mnt/opt ext3 noatime 1 2
/dev/mandrake/1 /home/knoppix/mnt/usr xfs noatime 1 2
/dev/mandrake/2 /home/knoppix/mnt/var xfs noatime 1 2
/dev/mandrake/5 /home/knoppix/mnt/var/spool ext3 noatime 1 2

Then I created a couple of scripts in /home/knoppix, .lvmon and .lvmoff (I had to make them dot files so saveconfig would save them):

.lvmon:
sudo vgscan && sudo vgchange -a y
mkdir /home/knoppix/mnt
sudo mount /dev/hda6
sudo mount /dev/hda5
sudo mount /dev/mandrake/3
sudo mount /dev/mandrake/6
sudo mount /dev/mandrake/4
sudo mount /dev/mandrake/1
sudo mount /dev/mandrake/2
sudo mount /dev/mandrake/5

.lvmoff
sudo umount /dev/mandrake/5
sudo umount /dev/mandrake/2
sudo umount /dev/mandrake/1
sudo umount /dev/mandrake/4
sudo umount /dev/mandrake/6
sudo umount /dev/mandrake/3
sudo umount /dev/hda5
sudo umount /dev/hda6
sudo vgchange -a n

I have found that if I forget to do .lvmoff that it still seems to work ok the next bootup (all volumes are unmounted during halt but no "vgchange -a n" is run as far as I know.

It would be nice if it could do something like this automatically without me having to manually rebuild like I did. Is lvm smart enough to do that? Is there a magic file that would rebuild /etc/fstab automagically, then properly mount it in the proper order?

Also, now that I have my mandrake tree, is there a way to have knoppix recognize my libs, etc? I have tried to run programs that I have on mandrake through knoppix, but most fail because it could not find the proper .so files or libs.

sireasoning
01-24-2003, 11:33 PM
--Hmmmm... This appears to be a different LVM than what I'm using. I have multiple physical drives LVM'ed into one mount point:

ls /dev/scsilvm -l
total 0
crw-r----- 1 root disk 109, 1 Dec 6 12:37 group
brw-rw---- 1 root disk 58, 1 Dec 6 12:37 scsilvm
dave:~> ls /dev/extralvm -l
total 0
brw-rw---- 1 root disk 58, 0 Dec 6 12:37 extralvm
crw-r----- 1 root disk 109, 0 Dec 6 12:37 group

--To save yourself some code, you could try (at least for the umount)
' sudo umount /dev/mandrake/? '

>> Also, now that I have my mandrake tree, is there a way to have knoppix recognize my libs, etc? I have tried to run programs that I have on mandrake through knoppix, but most fail because it could not find the proper .so files or libs.

--Mount your Mandrake root partition and chroot to it.
' mkdir /mnt/mdkroot '
' mount /dev/hdaX /mnt/mdkroot '
' chroot /mnt/mdkroot '

--You may have to mount things again inside, once you're chrooted. BTW, the chroot only works for the 1 VT (virtual-terminal) that you issued the command in.


I tried chroot, but it would not let the program run in X. It also ate ram like candy when I attempted to use mc.

Dave_Bechtel
01-25-2003, 10:31 PM
--I just remembered an easy way to get things mounted again in chroot:
' mount -a ' should do it.

--I wouldn't try running X from chroot, period... That's what booting *Mandrake* is for. :) But try ' mc ' again from chroot; what it's doing eating memory like that, I don't know... But it's prolly loading a bunch of support libs.




--Mount your Mandrake root partition and chroot to it.
' mkdir /mnt/mdkroot '
' mount /dev/hdaX /mnt/mdkroot '
' chroot /mnt/mdkroot '

--You may have to mount things again inside, once you're chrooted. BTW, the chroot only works for the 1 VT (virtual-terminal) that you issued the command in.


I tried chroot, but it would not let the program run in X. It also ate ram like candy when I attempted to use mc.