LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Can't mount a disk. Need some ideas. (https://www.linuxquestions.org/questions/linux-hardware-18/cant-mount-a-disk-need-some-ideas-562346/)

elemings 06-16-2007 09:26 PM

Can't mount a disk. Need some ideas.
 
I just upgraded to Fedora 7. I have two hard disks in my machine. Here's what I get from 'fdisk -l':

Disk /dev/sda: 27.3 GB, 27373731840 bytes
255 heads, 63 sectors/track, 3328 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3328 26627737+ 8e Linux LVM

Disk /dev/sdb: 74.3 GB, 74355769344 bytes
255 heads, 63 sectors/track, 9039 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 13 104391 83 Linux
/dev/sdb2 14 9039 72501345 8e Linux LVM


My previous OS is installed on the larger disk so when I went to upgrade, I just unplugged it and installed Fedora 7 on the smaller disk.

After installation, I plugged the disk back in and rebooted but now when I try to mount the disk with 'mount /dev/sdb2 /mnt', I get a 'mount: /dev/sdb2 already mounted or /mnt busy' error. It's not mounted or busy as far as I can tell.

I noticed others had problems with dm-mod/dm-mirror interferring so I tried uncommenting those lines from modules.dep but that didn't work. Also looked for locks in 'lsof' but nothing.

Could use some ideas.

Thanks,
Eric.

syg00 06-16-2007 09:38 PM

If you've got two Fedora systems installed, they probably have the same named VGs and LVs. Especially if the installer couldn't see the other disk - presumably would use the default names.

elemings 06-16-2007 09:39 PM

I think I have some idea of what happened at least. At some point, LVM2 could not see the larger disk so it just overwrote the previous logical volume. I get the following from 'lvscan':

WARNING: Duplicate VG name VolGroup00: Existing 8u2SkJ-28V0-iXPD-BSt3-o6KD-y6dx-rjLCVw (created here) takes precedence over 2NwURw-UN8n-bk21-sJqw-W8HZ-6w3A-HOXGFY

jschiwal 06-16-2007 09:54 PM

Why would you unplug the disk? Your drive assignments for one of the disk will be wrong in menu.lst and /etc/fstab. You will need to correct your /boot/grub/menu.lst and fstab files correcting the drive assignments. You might as well combine the entries from the other installs menu.lst so that both are on the same menu. Just use grub one of the first disks so that you don't get into a dueling MBR situation. Only update grub for one distro.

If there is a conflict between what grub sees as (hd0,0) when booting and what it sees as (hd0,0) after Linux is running, then edit the /boot/grub/device.map file to fix it.
Code:

(hd1)  /dev/sda
(hd0)  /dev/hda

It is simply a text file. The problem is if the root partition is (hd0) but when you boot the system is saying that hd0 is /dev/sda. Then it would try to boot from the wrong disk.

Another possibility is if there is drive information in an LVM or raid superblock and the kernel procedes to assemble the array. Then later, your /etc/fstab information is wrong and it tries to mount /dev/hdb2 instead of /dev/hda2.

elemings 06-16-2007 10:16 PM

Quote:

Originally Posted by jschiwal
Why would you unplug the disk?

So that nothing bad can possibly happen to it during system upgrade.

Quote:

Originally Posted by jschiwal
Your drive assignments for one of the disk will be wrong in menu.lst and /etc/fstab.

Here's my current /etc/fstab:

Code:

/dev/VolGroup00/LogVol00 /                      ext3    defaults        1 1
LABEL=/boot            /boot                  ext3    defaults        1 2
tmpfs                  /dev/shm                tmpfs  defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                  /sys                    sysfs  defaults        0 0
proc                    /proc                  proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0

Quote:

Originally Posted by jschiwal
You will need to correct your /boot/grub/menu.lst and fstab files correcting the drive assignments.

Here's my /boot/grub/menu.lst file:

Code:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.21-1.3228.fc7)
        root (hd0,0)
        kernel /vmlinuz-2.6.21-1.3228.fc7 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.21-1.3228.fc7.img
title Fedora (2.6.21-1.3194.fc7)
        root (hd0,0)
        kernel /vmlinuz-2.6.21-1.3194.fc7 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.21-1.3194.fc7.img

Quote:

Originally Posted by jschiwal
You might as well combine the entries from the other installs menu.lst so that both are on the same menu. Just use grub one of the first disks so that you don't get into a dueling MBR situation. Only update grub for one distro.

If there is a conflict between what grub sees as (hd0,0) when booting and what it sees as (hd0,0) after Linux is running, then edit the /boot/grub/device.map file to fix it.
Code:

(hd1)  /dev/sda
(hd0)  /dev/hda

It is simply a text file. The problem is if the root partition is (hd0) but when you boot the system is saying that hd0 is /dev/sda. Then it would try to boot from the wrong disk.

Another possibility is if there is drive information in an LVM or raid superblock and the kernel procedes to assemble the array. Then later, your /etc/fstab information is wrong and it tries to mount /dev/hdb2 instead of /dev/hda2.

I think that is the case. I can still mount the other logical volumes on the larger disk just not the root partition.

Code:

# ls -al /dev/VolGroup00
total 0
drwx------  2 root root  120 2007-06-16 22:11 .
drwxr-xr-x 12 root root 4440 2007-06-16 22:12 ..
lrwxrwxrwx  1 root root  31 2007-06-16 22:11 LogVol00 -> /dev/mapper/VolGroup00-LogVol00
lrwxrwxrwx  1 root root  31 2007-06-16 22:11 LogVol01 -> /dev/mapper/VolGroup00-LogVol01
lrwxrwxrwx  1 root root  31 2007-06-16 22:11 LogVol02 -> /dev/mapper/VolGroup00-LogVol02
lrwxrwxrwx  1 root root  31 2007-06-16 22:11 LogVol03 -> /dev/mapper/VolGroup00-LogVol03

When I try to mount LogVol00, I just get the root partition of the smaller disk. Any LVM2 experts out there? :P

syg00 06-16-2007 10:45 PM

Personally I would leave them as separate systems, and change the boot disk via the BIOS. Then use a (new) shared partition to copy/move share data to. If you really need to get at the data, you'll probably have to rename LVs (at least) - maybe even the VGs as well.
Ugh.
Then, of course, there'll be issues with the systems that owned that data originally.
Double ugh.

There's a lvm guide at tldp.org - start reading there.

Caveat: I don't use LVM (this sort of thing is one of the reasons why), so this is just me theorizing.

elemings 06-16-2007 10:49 PM

Quote:

Originally Posted by syg00
If you've got two Fedora systems installed, they probably have the same named VGs and LVs. Especially if the installer couldn't see the other disk - presumably would use the default names.

I see that:

Code:

# vgdisplay
  WARNING: Duplicate VG name VolGroup00: Existing 8u2SkJ-28V0-iXPD-BSt3-o6KD-y6dx-rjLCVw (created here) takes precedence over 2NwURw-UN8n-bk21-sJqw-W8HZ-6w3A-HOXGFY
  --- Volume group ---
  VG Name              VolGroup00
  System ID           
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  23
  VG Access            read/write
  VG Status            resizable
  MAX LV                0
  Cur LV                4
  Open LV              2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size              69.12 GB
  PE Size              32.00 MB
  Total PE              2212
  Alloc PE / Size      2211 / 69.09 GB
  Free  PE / Size      1 / 32.00 MB
  VG UUID              2NwURw-UN8n-bk21-sJqw-W8HZ-6w3A-HOXGFY
 
  --- Volume group ---
  VG Name              VolGroup00
  System ID           
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access            read/write
  VG Status            resizable
  MAX LV                0
  Cur LV                2
  Open LV              2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size              25.38 GB
  PE Size              32.00 MB
  Total PE              812
  Alloc PE / Size      811 / 25.34 GB
  Free  PE / Size      1 / 32.00 MB
  VG UUID              8u2SkJ-28V0-iXPD-BSt3-o6KD-y6dx-rjLCVw

Would 'vgrename' work?

jschiwal 06-17-2007 05:31 PM

Is this menu.lst from the FC7 you installed on the second disk?
Code:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.21-1.3228.fc7)
        root (hd0,0)
        kernel /vmlinuz-2.6.21-1.3228.fc7 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.21-1.3228.fc7.img
title Fedora (2.6.21-1.3194.fc7)
        root (hd0,0)
        kernel /vmlinuz-2.6.21-1.3194.fc7 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.21-1.3194.fc7.img

The root disk indicated is (hd0,0) which I think is /dev/sda1 instead of /dev/sdb1 which is the one you installed FC7 on. However check the device.map file to make sure that (hd0,0) is /dev/sda1. When you installed it with the first disk out, (hd1,0) became (hd0,0). Now with it in again, it is (hd1,0) again.

elemings 06-17-2007 09:51 PM

Quote:

Originally Posted by jschiwal
The root disk indicated is (hd0,0) which I think is /dev/sda1 instead of /dev/sdb1 which is the one you installed FC7 on. However check the device.map file to make sure that (hd0,0) is /dev/sda1. When you installed it with the first disk out, (hd1,0) became (hd0,0). Now with it in again, it is (hd1,0) again.

Not sure what that has to do with my problem. I just need to be able to mount the root volume on the disk. The problem is that both root volumes have the same name and, currently, LVM2 is not capable of resolving the problem.


All times are GMT -5. The time now is 07:41 PM.