LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 09-06-2012, 03:00 AM   #1
Barx
Member
 
Registered: Jun 2004
Distribution: Slack x86 current
Posts: 128

Rep: Reputation: 16
Manually assign a device name to a specific HDD


Hi all

I have a PC that I use to clone HDDs, recover and copy data, ecc ecc.

The PC has slackware installed onto an IDE drive. Normally I work on SATA drives so I'm happy to have the OS on the IDE hdd so I have all SATA ports free.

But I have a problem: the IDE drive always gets the last letter after all the sata disks. If it's the only one it becomes sda, with 1 sata disk becomes sdb, with 2 sata disks sdc and so on.

Of course I get a kernel panic on every boot until I pass 'mount root=/dev/sdx' option each time to lilo with the actual IDE drive name

So I would like to stick manually a name to the disk so it will always be /dev/sda (or /dev/sdz or /dev/drivewithacustomname ) so I don't have more troubles on every boot.

I always tried to play with /dev/root (telling lilo to boot from /dev/root ) in various attempts, but without any result (I think that beacuse /dev/root is a symlink and lilo uses the link target, that will change moving drives)

Any hint??

Thank you all

Bye

Alessandro
 
Old 09-06-2012, 04:26 AM   #2
bormant
Member
 
Registered: Jan 2008
Posts: 112

Rep: Reputation: 51
You can try to assign label to your Slackware root partition, for ex. swroot
Code:
e2label /dev/sda1 swroot
, and then pass it instead of device name to kernel as
Code:
root=LABEL=swroot
in LILO prompt or as
Code:
root = "LABEL=swroot"
in /etc/lilo.conf. Note, that any changes in lilo.conf require to run lilo.

Does it help?

Last edited by bormant; 09-06-2012 at 04:41 AM. Reason: lilo.conf syntax
 
Old 09-06-2012, 05:16 AM   #3
Barx
Member
 
Registered: Jun 2004
Distribution: Slack x86 current
Posts: 128

Original Poster
Rep: Reputation: 16
Great idea!

I'm trying. I've labeled the root partition and the swap partition

Then I've edited lilo.conf and fstab telling them to use labeled partitions.

But I can't boot the system. I also tried to pass the option to lilo (Linux mount root=label=slackware), no way.

But if I pass mount root=/dev/sda2 the system boots correctly, and mounts root and swap partitions, so the labeling and syntax used in fstab both works.

But I can't tell to lilo to use labels ... now I do some other tests..
 
Old 09-06-2012, 05:40 AM   #4
diwljina
Member
 
Registered: Jun 2009
Distribution: Slackware, Debian
Posts: 105

Rep: Reputation: 8
You can use UUIDs. They are unique to every partition.

Code:
ls -l /dev/disk/by-uuid
will give you UUIDs of your disks.

Then, you can use them in fstab and lilo.conf.

fstab:
Code:
UUID={YOUR-UID}    {/path/to/mount/point}               {file-system-type}    defaults 0       1
But, it seems that you have to have initrd for this to work.

This should be helpful:
http://nil-techno.blogspot.com/2012/...s-by-uuid.html
 
Old 09-06-2012, 06:39 AM   #5
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad W520
Posts: 4,662

Rep: Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236
I add to what diwljina wrote that the "blkid" command will give you the file types in addition.

And using an initd is not mandatory.
 
Old 09-06-2012, 07:10 AM   #6
Barx
Member
 
Registered: Jun 2004
Distribution: Slack x86 current
Posts: 128

Original Poster
Rep: Reputation: 16
No way

Always get kernel panic

I'm not using an initrd

But I can see a strange behaviour: on the kernel panic screen, I can see the list of all drives and partitions, each one has an hex code with a structure similar to an UUID, but this codes are DIFFERENT from the ones seen by blkid, and for the IDE disk these codes are 00000000-0000-0000-0000-00000000000 for both partitions ..

I don't know if this may help..

Thank you for yout effort, I'll go trying other options...
 
Old 09-06-2012, 07:46 AM   #7
turtleli
Member
 
Registered: Aug 2012
Location: UK
Distribution: Slackware, Slackware 64, Slackware ARM, Gentoo, Fedora
Posts: 160

Rep: Reputation: Disabled
This page from the ArchLinux wiki might be what you are looking for: https://wiki.archlinux.org/index.php..._device_naming
 
Old 09-06-2012, 08:37 AM   #8
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad W520
Posts: 4,662

Rep: Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236Reputation: 1236
You may just need to allow a delay before your SATA disk become available.

In the relevant stanza of lilo.conf add:
Code:
append = "rootdelay=30"
Of course adapt as needed, 30 means 30 seconds.

Last edited by Didier Spaier; 09-06-2012 at 08:46 AM.
 
Old 09-06-2012, 11:38 AM   #9
bormant
Member
 
Registered: Jan 2008
Posts: 112

Rep: Reputation: 51
Quote:
Originally Posted by Barx View Post
Linux mount root=label=slackware
Please, try this literally at LILO prompt:
Code:
Linux root="LABEL=slackware"
Does it help?

ps.
/usr/src/linux/Documentation/kernel-parameters.txt says to see about kernel root= parameter name_to_dev_t comment in init/do_mounts.c.
This comment says nothing about "LABEL=", so it is initrd sripts magic. It also says that PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF accepted by kernel itself but if partition table provides it.

Last edited by bormant; 09-06-2012 at 11:56 AM. Reason: About PARTUID=
 
Old 09-07-2012, 01:01 PM   #10
Barx
Member
 
Registered: Jun 2004
Distribution: Slack x86 current
Posts: 128

Original Poster
Rep: Reputation: 16
Thank you all fro your efforts.

Sorry but today I was out of office and I had no time to test, I'll restart testing this monday

I'll try to deal with rootdelay, but I don't think this will fix because using the device name like /dev/sde1

here you can find the relevant parts of my testbed, just to view if something is wrong

partition labels and UUIDs:

Code:
root@server:~# blkid 
/dev/sde1: UUID="c347c1e4-e49f-4b7b-914d-b8f681c03428" TYPE="swap" LABEL="slackswap" 
/dev/sde2: LABEL="slackware" UUID="8563d7da-09d8-4956-a6a4-77e2e3eb341e" TYPE="ext4"
fstab (perfectly working):

Code:
LABEL=slackswap        swap             swap        defaults         0   0
LABEL=slackware        /                ext4        defaults         1   1
lilo.conf

Code:
image = /boot/vmlinuz
 # root="LABEL=slackware"
 # append = "root=UUID=8563d7da-09d8-4956-a6a4-77e2e3eb341e"
 # append = "root=LABEL=slackware"
 label = Linux_test
 read-only
I tried the three commented line (only one for time) without results

Monday I will do further tests

Thank you all

Alessandro Barisone

Last edited by Barx; 09-07-2012 at 01:02 PM.
 
Old 09-07-2012, 04:28 PM   #11
gezley
Member
 
Registered: Sep 2009
Location: Ireland
Distribution: Slackware-64, Crux-64, NetBSD-64
Posts: 558

Rep: Reputation: 270Reputation: 270Reputation: 270
Post

Quote:
Originally Posted by Barx View Post
here you can find the relevant parts of my testbed, just to view if something is wrong

partition labels and UUIDs:

Code:
root@server:~# blkid 
/dev/sde1: UUID="c347c1e4-e49f-4b7b-914d-b8f681c03428" TYPE="swap" LABEL="slackswap" 
/dev/sde2: LABEL="slackware" UUID="8563d7da-09d8-4956-a6a4-77e2e3eb341e" TYPE="ext4"
fstab (perfectly working):

Code:
LABEL=slackswap        swap             swap        defaults         0   0
LABEL=slackware        /                ext4        defaults         1   1
This is how your fstab should look with UUIDs:

Code:
UUID=c347c1e4-e49f-4b7b-914d-b8f681c03428   swap   swap   defaults   0 0
UUID=8563d7da-09d8-4956-a6a4-77e2e3eb341e   /    ext4   defaults   1 1
When you specified UUIDs in your fstab did you perhaps neglect to remove the quotation marks around them?
 
Old 09-07-2012, 05:32 PM   #12
turtleli
Member
 
Registered: Aug 2012
Location: UK
Distribution: Slackware, Slackware 64, Slackware ARM, Gentoo, Fedora
Posts: 160

Rep: Reputation: Disabled
Seems you do need an initrd if you use the UUID or LABEL method. See http://www.linuxquestions.org/questi...uid%3D-929098/ for someone who had a similar problem.
 
Old 10-29-2012, 04:43 AM   #13
Barx
Member
 
Registered: Jun 2004
Distribution: Slack x86 current
Posts: 128

Original Poster
Rep: Reputation: 16
OK it works!

initrd is required to do the trick. I think that the label (or UUID) is seen only if the module for the root file system is loaded via initrd.

I've used a 'simple' initrd containing only ext3 module (the one used for root file system in my testbed) created with

Code:
mkinitrd -c -k 3.2.29 -m ext3 -f ext3 -r /dev/sda1
then added this line

Code:
append = "root=LABEL=slackware"
(put in the correct lilo entry, not in common section)

and now system boots perfectly!

Thank you all for your help!

Last edited by Barx; 10-29-2012 at 04:45 AM.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
if you want to assign some tasks to specific user dellroxy Solaris / OpenSolaris 2 10-14-2008 10:47 AM
Manually configuring DHCP for static IP -- cannot assign IP tristanlee85 Linux - Networking 3 10-16-2005 02:34 AM
Assign one USB-storage device to one device file Misel Linux - Hardware 1 08-28-2004 04:52 AM
How do you assign a process to a specific processor? ter_roshak Linux - General 1 12-19-2003 01:38 AM
Assign Privs to specific user sikandar Linux - Software 13 08-31-2003 03:12 AM


All times are GMT -5. The time now is 03:15 PM.

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