View previous topic :: View next topic |
Author |
Message |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sun Jul 20, 2008 6:54 pm Post subject: (SOLVED)How do I use a fixed address in fstab for harddrives |
|
|
Lately Linux habit of randomly renaming the various /dev/sd* is driveing me nuts. Currently I even have problems booting because the name of my root partition is constantly switching between sdc2 and sdg2
I remember fro my opensuse days that it is possible use a fixed address for your fstab entries. I wonder if this is also possible in Gentoo and if so how can I apply this? _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered
Last edited by Kasumi_Ninja on Sun Jul 27, 2008 7:57 am; edited 1 time in total |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 47017 Location: 56N 3W
|
Posted: Sun Jul 20, 2008 7:11 pm Post subject: |
|
|
Aniruddha,
You can use LABEL= or UUID= but the patch to make that work needs an initrd.
I don't think you can use udev to rename root because it would need to run before root was mounted, which is tricky without an inirrd
You can use udev to rename things after root is mounted but if root moves around, its a little late then _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sun Jul 20, 2008 7:40 pm Post subject: |
|
|
NeddySeagoon wrote: | Aniruddha,
You can use LABEL= or UUID= but the patch to make that work needs an initrd.
I don't think you can use udev to rename root because it would need to run before root was mounted, which is tricky without an inirrd
You can use udev to rename things after root is mounted but if root moves around, its a little late then |
I have a initrd (though genkernel) so that shouldn't be problem, where can I find more info about using this feature?. In the meantime I have a serious problem; I can't boot .
I couldn't boot because root changed from sdc2 to sdb2, I changed fstab accordingly and rebooted. It failed to boot since the root partition was now on sdc2  _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
 |
gerard27 Advocate

Joined: 04 Jan 2004 Posts: 2377 Location: Netherlands
|
Posted: Sun Jul 20, 2008 7:49 pm Post subject: |
|
|
If you have a livecd the solution is simple.
Mount your /boot hd-partition to a directory
then open /grub/grub.conf and change it to the new hd.
Gerard. _________________ To install Gentoo I use sysrescuecd.Based on Gentoo,has firefox to browse Gentoo docs and mc to browse (and edit) files.
The same disk can be used for 32 and 64 bit installs.
You can follow the Handbook verbatim.
http://www.sysresccd.org/Download |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 47017 Location: 56N 3W
|
Posted: Sun Jul 20, 2008 7:55 pm Post subject: |
|
|
Aniruddha,
I know of the method and that you can find your uuids in /dev/disk/by-uuid
How you use that information in grub.conf and /etc/fstab, I'm not sure.
Other distros do it, have a peek at their sites.
The genkernel initrd supports labels and uuids, thats a snippit I picked up here in the last few days.
My raid sets don't seem to have uuids :( _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sun Jul 20, 2008 7:58 pm Post subject: |
|
|
Gerard van Vuuren wrote: | If you have a livecd the solution is simple.
Mount your /boot hd-partition to a directory
then open /grub/grub.conf and change it to the new hd.
Gerard. |
That's what I did but the device name kept changing (from sdc to sdg to sdb)... _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
 |
gsoe Apprentice

Joined: 10 Dec 2006 Posts: 289 Location: Denmark
|
Posted: Sun Jul 20, 2008 8:22 pm Post subject: |
|
|
I'm quite annoyed at the UUID using distros because I keep about ten partitions to try out other distros when they come up with new editions, so I have changing UUID's everytime I install a new distro. That's making a lot of the other distros unbootable....
Anyway the problem here is the opposite, here's a snippet from mandriva's fstab: Code: | # Entry for /dev/sda10 :
LABEL=Mandriva / ext3 noatime 1 1
...
...
# Entry for /dev/sda6 :
UUID=0a4bc37e-8aa4-40c0-81d8-bf7778c15a23 /media/hd4 reiserfs noauto 1 2
... | and this is from grub.conf: Code: | title linux
kernel (hd0,9)/boot/vmlinuz BOOT_IMAGE=linux root=LABEL=Mandriva resume=/dev/sda3
initrd (hd0,9)/boot/initrd.img
| The UUID's are there automagically, as mentioned you find them in /dev/disk/by-uuid. I don't know about labels, you might have to set them yourself. Hope this is a help, good luck.
Anyway, how come your devicenames are changing? Unless you change hardware that shouldn't happen I think... Do you have both the old and new SATA drivers enabled in the kernel? |
|
Back to top |
|
 |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sun Jul 20, 2008 8:30 pm Post subject: |
|
|
gsoe wrote: | I'm quite annoyed at the UUID using distros because I keep about ten partitions to try out other distros when they come up with new editions, so I have changing UUID's everytime I install a new distro. That's making a lot of distros unbootable....
Anyway the problem here is the opposite, here's a snippet from mandriva's fstab: Code: | # Entry for /dev/sda10 :
LABEL=Mandriva / ext3 noatime 1 1
...
...
# Entry for /dev/sda6 :
UUID=0a4bc37e-8aa4-40c0-81d8-bf7778c15a23 /media/hd4 reiserfs noauto 1 2
... | and this is from grub.conf: Code: | title linux
kernel (hd0,9)/boot/vmlinuz BOOT_IMAGE=linux root=LABEL=Mandriva resume=/dev/sda3
initrd (hd0,9)/boot/initrd.img
| The UUID's are there automagically, as mentioned you find them in /dev/disk/by-uuid. I don't know about labels, you might have to set them yourself. Hope this is a help, good luck.
Anyway, how come your devicenames are changing? Unless you change hardware that shouldn't happen I think... Do you have both the old and new SATA drivers enabled in the kernel? |
Thanks for the help! I managed to adjust my fstab using uuid and my system boots fine . To find the unique volume identifier use the following command (substitute /dev/sda with your drive):
Code: | # vol_id -u /dev/sda |
How do UUID's work with removable media like usb stick? Since initrd is used I wonder if you have to plugin the usb stick at boot, or is it hot-plugable? _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 47017 Location: 56N 3W
|
Posted: Sun Jul 20, 2008 8:33 pm Post subject: |
|
|
Aniruddha,
UUIDs are fixed at file system create time. They are ok with removable devices _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
yabbadabbadont Advocate


Joined: 14 Mar 2003 Posts: 4791 Location: 2 exits past crazy
|
Posted: Sun Jul 20, 2008 8:33 pm Post subject: |
|
|
I have my Gentoo system converted to using UUID for everything. Here are my fstab and grub.conf files in case it helps.
/etc/fstab:
Code: | UUID=90B5-E9EB /mnt/windows vfat utf8,umask=007,gid=users,quiet 0 2
UUID=5e7ca13e-5fce-4477-a967-68c2213a8d74 /boot ext3 noauto,noatime 0 3
UUID=174c42d0-10cd-436d-aa0d-d94bbe062a3e / ext3 noatime 0 1
UUID=0c400f84-71f7-4faf-8229-39417ef34b39 /home ext3 noatime 0 4
UUID=53106d93-9666-4fb1-8177-01cb23930d55 /mnt/backup ext3 noatime 0 5
UUID=2eacc7c6-729a-46a8-a6f9-8cd1b148a411 /mnt/music ext3 noatime 0 6
UUID=0b1639fd-e7c6-4a2f-a163-3258ce26dc8b /mnt/video1 ext3 noatime 0 7
UUID=5c4dce4d-83ee-419b-a770-18fea9c83359 /mnt/video2 ext3 noatime 0 8
UUID=ef102bc3-f432-48fc-9bfe-c0fe27cb35fc /mnt/images ext3 noatime 0 9
UUID=4830c333-6657-4a91-b8b2-551cc88d4fe4 none swap sw 0 0
|
/boot/grub/grub.conf:
Code: | default 0
timeout 10
color cyan/blue white/blue
title Gentoo 2.6.25-gentoo-r6
root (hd0,1)
kernel /bzImage-2.6.25-gentoo-r6 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=UUID=174c42d0-10cd-436d-aa0d-d94bbe062a3e vga=775 udev quiet
initrd /initramfs-genkernel-x86-2.6.25-gentoo-r6
title Windows
rootnoverify (hd0,0)
makeactive
chainloader +1
title Poweroff
halt
|
|
|
Back to top |
|
 |
gsoe Apprentice

Joined: 10 Dec 2006 Posts: 289 Location: Denmark
|
Posted: Sun Jul 20, 2008 8:37 pm Post subject: |
|
|
Quote: | How do UUID's work with removable media like usb stick? Since initrd is used I wonder if you have to plugin the usb stick at boot, or is it hot-plugable? | Well, I don't know. I suppose that it's hot-pluggable and that hal takes care of things, but I'll reboot into mandriva and try it out. Just a minute...
Is your problem that you get different devicenames when you boot with a plugged usb-stick compared to when you don't? |
|
Back to top |
|
 |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sun Jul 20, 2008 8:41 pm Post subject: |
|
|
gsoe wrote: | Quote: | How do UUID's work with removable media like usb stick? Since initrd is used I wonder if you have to plugin the usb stick at boot, or is it hot-plugable? | Well, I don't know. I suppose that it's hot-pluggable and that hal takes care of things, but I'll reboot into mandriva and try it out. Just a minute...
Is your problem that you get different devicenames when you boot with a plugged usb-stick compared to when you don't? |
Coming to think of it, that was another major problem I encountered with my 'regular' fstab. Every I left a usb device plugged during boot it didn't boot (since the usb stick messed up the device numbering).
Coming to think of it, do I have to adjust my grub.conf (especially the real_root line)? My grub.conf:
Code: | # cat /boot/grub/grub.conf
# Which listing to boot as default. 0 is the first, 1 the second etc.
default 0
# How many seconds to wait before the default listing is booted.
timeout 5
# Nice, fat splash-image to spice things up :)
# Comment out if you don't have a graphics card installed
#splashimage=(hd0,1)/boot/grub/splash.xpm.gz
title=Gentoo Linux (2.6.25-gentoo-r6)
root (hd0,1)
kernel /boot/kernel-genkernel-x86-2.6.25-gentoo-r6 real_root=/dev/sdc2
initrd /boot/initramfs-genkernel-x86-2.6.25-gentoo-r6 |
_________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
 |
yabbadabbadont Advocate


Joined: 14 Mar 2003 Posts: 4791 Location: 2 exits past crazy
|
Posted: Sun Jul 20, 2008 8:49 pm Post subject: |
|
|
Aniruddha wrote: | Coming to think of it, do I have to adjust my grub.conf (especially the real_root line)? My grub.conf: |
See my previous post for a working example after which you can pattern yours.  |
|
Back to top |
|
 |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sun Jul 20, 2008 8:51 pm Post subject: |
|
|
yabbadabbadont wrote: | Aniruddha wrote: | Coming to think of it, do I have to adjust my grub.conf (especially the real_root line)? My grub.conf: |
See my previous post for a working example after which you can pattern yours.  |
Oops, I overlooked that entry, thanks! _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
 |
gsoe Apprentice

Joined: 10 Dec 2006 Posts: 289 Location: Denmark
|
Posted: Sun Jul 20, 2008 9:13 pm Post subject: |
|
|
The UUID part seems solved, but I'm quite puzzled by your changing devicenames. I've tried rebooting mandriva (and Gentoo) a couple of times now with and without a plugged usb-stick. It doesn't affect devicenames. I have /dev/sda and /dev/sdb hard drives and the stick allways shows as /dev/sdc. However I did experience once, that by adding a third harddrive, the former /dev/sda and /dev/sdb changed... Does anybody have useful info?
Mandriva simply doesn't mount the plugged stick at boot, but when it's mounted, it's always /dev/sdb (there's no mounting of my /dev/sdb harddrive in fstab). I get this Code: | [gert@localhost ~]$ ls /dev/disk/by-uuid/
0a4bc37e-8aa4-40c0-81d8-bf7778c15a23@ 47E0-17A3@
0a4be4e4-6fd6-44a3-b878-f1cebc9d347b@ 69cdd8ef-e37a-4d74-9b71-1feabb513a1b@
10F08273F0825F3A@ 89cd7e0f-98eb-4c20-9711-c081aa9a549e@
12affa1b-e0f1-42bd-9c0b-b61ddb69fc7c@ 8b4c45e6-de6c-4930-b065-57fd6e087c57@
1552358b-23bd-4a40-9802-595872034f9a@ ba072c66-f0d1-4f11-8dd8-c49e455ca675@
1c04fea6-1780-450b-bbe6-c11c6bdea9ed@ be836e7c-8dd0-4025-ac7f-dae61bad4fc7@
2e7e35fa-2d65-42bb-9fbf-7fa193245b24@ da81878c-da56-421e-8801-e42a024c2cea@
2f00fced-49fe-4beb-a0ce-9dfa18ebd4f5@ EAACF81CACF7E14D@
317f34eb-5450-4402-94b8-581beaf0c4f3@
| no matter if the stick is present, mounted or not, so it seems that the stick filesystem doesn't have a UUID (at least when it's fat). |
|
Back to top |
|
 |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Sun Jul 20, 2008 9:23 pm Post subject: |
|
|
yabbadabbadont wrote: | Aniruddha wrote: | Coming to think of it, do I have to adjust my grub.conf (especially the real_root line)? My grub.conf: |
See my previous post for a working example after which you can pattern yours.  |
Unfortunately I can't boot using UUID in grub. I compiled genkernel with the --disklabel option but aparantly something is still missing?
Code: | # genkernel --install --bootloader=grub --menuconfig --disklabel all
* Gentoo Linux Genkernel; Version 3.4.10
* Running with options: --install --bootloader=grub --menuconfig --disklabel all |
Code: | # cat /boot/grub/grub.conf
# Which listing to boot as default. 0 is the first, 1 the second etc.
default 1
# How many seconds to wait before the default listing is booted.
timeout 5
# Nice, fat splash-image to spice things up :)
# Comment out if you don't have a graphics card installed
#splashimage=(hd0,1)/boot/grub/splash.xpm.gz
title=Gentoo Linux (2.6.25-gentoo-r6)
root (hd0,1)
kernel /boot/kernel-genkernel-x86-2.6.25-gentoo-r6 real_root=/dev/sdc2
initrd /boot/initramfs-genkernel-x86-2.6.25-gentoo-r6
title=Gentoo Linux (2.6.24-gentoo-r8)
root (hd0,1)
kernel /boot/kernel-genkernel-x86-2.6.24-gentoo-r8 real_root=UUID=dd4927a2-e1f4-4955-8aa7-76a11d8c3aca udev
initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r8 |
@gsoe
The problems started when I inserted another hard drive (and another one). _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
 |
yabbadabbadont Advocate


Joined: 14 Mar 2003 Posts: 4791 Location: 2 exits past crazy
|
Posted: Sun Jul 20, 2008 9:33 pm Post subject: |
|
|
Someone needs to learn to read more closely...
You left out: Code: | root=/dev/ram0 init=/linuxrc ramdisk=8192 |
|
|
Back to top |
|
 |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Mon Jul 21, 2008 7:48 am Post subject: |
|
|
yabbadabbadont wrote: | Someone needs to learn to read more closely...
You left out: Code: | root=/dev/ram0 init=/linuxrc ramdisk=8192 |
|
I though these were optional...  _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
 |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Mon Jul 21, 2008 4:08 pm Post subject: |
|
|
yabbadabbadont wrote: | Someone needs to learn to read more closely...
You left out: Code: | root=/dev/ram0 init=/linuxrc ramdisk=8192 |
|
Unofrtunately I still have problems booting
Code: | $ cat /boot/grub/grub.conf
# Which listing to boot as default. 0 is the first, 1 the second etc.
default 1
# How many seconds to wait before the default listing is booted.
timeout 5
# Nice, fat splash-image to spice things up :)
# Comment out if you don't have a graphics card installed
#splashimage=(hd0,1)/boot/grub/splash.xpm.gz
title=Gentoo Linux (2.6.25-gentoo-r6)
root (hd0,1)
kernel /boot/kernel-genkernel-x86-2.6.25-gentoo-r6 real_root=/dev/sdc2
initrd /boot/initramfs-genkernel-x86-2.6.25-gentoo-r6
title=Gentoo Linux (2.6.24-gentoo-r8)
root (hd0,1)
kernel /boot/kernel-genkernel-x86-2.6.24-gentoo-r8 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=UUID=dd4927a2-e1f4-4955-8aa7-76a11d8c3aca udev
initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r8 |
_________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
 |
yabbadabbadont Advocate


Joined: 14 Mar 2003 Posts: 4791 Location: 2 exits past crazy
|
Posted: Mon Jul 21, 2008 4:20 pm Post subject: |
|
|
What is the error message? (the first one, not the panic at the end)
Edit: You may want to add "verbose" to the end of your kernel options. |
|
Back to top |
|
 |
cyrillic Watchman


Joined: 19 Feb 2003 Posts: 7313 Location: Groton, Massachusetts USA
|
Posted: Mon Jul 21, 2008 4:32 pm Post subject: |
|
|
Aniruddha wrote: | gsoe wrote: | Is your problem that you get different devicenames when you boot with a plugged usb-stick compared to when you don't? |
Coming to think of it, that was another major problem I encountered with my 'regular' fstab. Every I left a usb device plugged during boot it didn't boot (since the usb stick messed up the device numbering). |
The simple solution to that particular problem is to configure usb-storage as a module instead of having it compiled-in.
That way, USB drives will always get enumerated after your internal harddrives. |
|
Back to top |
|
 |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Mon Jul 21, 2008 4:39 pm Post subject: |
|
|
yabbadabbadont wrote: | What is the error message? (the first one, not the panic at the end)
Edit: You may want to add "verbose" to the end of your kernel options. |
It's the default error message you get when trying to boot from a wrong partition:
Code: | "/dev/sdc2" could not be found
Superblock could not be read
press Ctrl+D for reboot or enter you password for maintenance |
_________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
 |
yabbadabbadont Advocate


Joined: 14 Mar 2003 Posts: 4791 Location: 2 exits past crazy
|
Posted: Mon Jul 21, 2008 4:41 pm Post subject: |
|
|
Are you sure that you took the correct option off of your grub boot menu? |
|
Back to top |
|
 |
Kasumi_Ninja Veteran


Joined: 18 Feb 2006 Posts: 1825 Location: The Netherlands
|
Posted: Mon Jul 21, 2008 5:00 pm Post subject: |
|
|
yabbadabbadont wrote: | Are you sure that you took the correct option off of your grub boot menu? |
It boots per default the second option, therefor I'm pretty sure I got the correct one  _________________ Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered |
|
Back to top |
|
 |
danomac l33t


Joined: 06 Nov 2004 Posts: 877 Location: Vancouver, BC
|
Posted: Mon Jul 21, 2008 6:12 pm Post subject: |
|
|
gsoe wrote: | The UUID part seems solved, but I'm quite puzzled by your changing devicenames. I've tried rebooting mandriva (and Gentoo) a couple of times now with and without a plugged usb-stick. It doesn't affect devicenames. |
I'm not, I've seen the changing device names on my own PC. I've actually had multiple UUIDs even show up for a partition.
I wound up having to alias one controller so this wouldn't happen. It's really frustrating when your /home partition doesn't mount properly.
It's very easy to reproduce. Get a PCI/PCI-e SATA controller. Then plug in a usb drive or two and reboot. Everything gets remapped! Using UUIDs didn't fix it for me as my box (for some odd reason) would get multiple UUID entries for some devices, completely screwing up any mounting.
I would guess the reason for this is the boot ordering of the BIOS. Mine goes from onboard SATA->onboard IDE->USB->IEEE1394->PCI-e slots.
Inserting either a ieee1394 drive or a usb flash drive would get all sorts of random reordering. (My RocketRaid card would be sde, sgh, and sdi depending on what would be plugged in at the time.)
I used udev to alias my rocketraid controller to /dev/hptX so I didn't have to guess which on it is.
I didn't see anything in my BIOS to disable any of these controllers, although I didn't really look very hard.  |
|
Back to top |
|
 |
|