Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#65 closed enhancement (worksforme)

Keeping SD disk as rootfs disk

Reported by: anonRSpro Owned by: stappers
Priority: major Milestone: milestone:
Component: openwrt Version: 2.0
Severity: Keywords:
Cc:

Description (last modified by stappers)

On my rs pro I have an SD card with rootfs and swap. At boot the system recognise as sda1 sda2 and everything is working fine. If I connect an external USB disk and I reboot the system the external disk became sda and the SD became sdb giving me obvioulsy a kernel panic because the system didn't find the right rootfs partition to boot.
Is there a way to specify uniquely during the first step of the boot process the device booting from?

Attachments (0)

Change History (14)

comment:1 Changed 9 years ago by stappers

label

comment:2 Changed 9 years ago by anonymous

can you explain me a little?

comment:3 Changed 9 years ago by stappers

  • Owner changed from amain to stappers
  • Status changed from new to accepted

Happy New Year!

It was short before I went to bed, when I saw the first time ticket #65.
I should have update the ticket with seen or with

root=LABEL=DEBWRT

Now some explaination:

Telling debwrt to use a disk label has to be done at to two places

  • Change bootparameter root=/dev/sda1 into root=LABEL=DEBWRT. Do this with make menuconfig under Kernel Configuration ---> and Default kernel command line, rebuild the kernel with make.
  • Label the root partition DEBWRT with e2label, tune2fs or at mkfs. Example given
    sudo e2label /dev/sdb1 DEBWRT
    

(That example is done on a host computer with has disk /dev/sda itself and where the SDcard is detect as /dev/sdb)

comment:5 follow-up: Changed 9 years ago by stappers

For what it's worth:

In my Qemu environment does a root=LABEL=DEBWRT not work.

Using root=UUID=cb2b01bc-9288-45f9-9cc5-b036dc020c14, where UUID="cb2b01bc-9288-45f9-9cc5-b036dc020c14 was found by blkid, didn't neither work.

I'm curious what the results on real hardware are ...

comment:6 in reply to: ↑ 5 Changed 9 years ago by stappers

Replying to stappers:

I'm curious what the results on real hardware are ...

It seems no hardware_versus_emulation_issue, it seems that root=LABEL=DEBWRT is a bootloader thing.
See http://www.mail-archive.com/blfs-support@linuxfromscratch.org/msg10162.html for more information.

comment:7 Changed 9 years ago by stappers

  • Description modified (diff)
  • Reporter changed from anonymous to anonRSpro
  • Status changed from accepted to assigned
  • Summary changed from how can i specify to Keeping SD disk as rootfs disk
  • Type changed from defect to enhancement

comment:8 Changed 9 years ago by stappers

If someone makes me stakeholder by sending me a RouterStation Pro, I willing to spend more time on it.

E-mail me at stappers (A) stappers NL

comment:9 Changed 9 years ago by amain

  • Resolution set to worksforme
  • Status changed from assigned to closed

The root=LABEL= notation or UUID notation can only be used when using a initrd with scripts / tools that support this syntax. One of the ideas I have been playing with is to create a initrd for DebWrt. However, this is work and currently there is to little need for this.

A workaround:

  • build DebWrt yourself
  • edit .config and change in the CONFIG_CMDLINE= the root= parameter ( use /dev/sdb1 )

comment:10 follow-up: Changed 9 years ago by k.szczesny@…

Hi,

I just stumbled upon same issue as OP, however I am not using secondary hard drive, rather an 3G modem.
Nowadays these damn things act as pendrives as well as modems and every second boot 3g modem will get assigned as sda device and will result in kernel panic.
I've tried using UUID but ended up with the same problem as reported by stappers in previous comment.
I don't want to report a bug, I am just trying to figure out a way to solve my problem.
Is there any other way I could boot DebWrt without using /dev/sdX as boot parameter?

comment:11 in reply to: ↑ 10 Changed 9 years ago by stappers

Replying to k.szczesny@…:

Is there any other way I could boot DebWrt without using /dev/sdX as boot parameter?

The complete bootparameter is

root=/dev/sdX

A kernel does need to known where it can find the root filesystem.
IIRC is /dev/hda1 the default value.

HTH

comment:12 Changed 9 years ago by k.szczesny@…

but..
I can't use /dev/sdX when every second boot my harddrive has a different letter assigned.
One time it is sda and other it is sdb.
This is why I am looking for an alternative.

comment:13 Changed 9 years ago by stappers

The easy workaround is to boot each time with the same hardware.

Best configuration for same hardware is one single USB storage device.

When there is only one USB storage device, it will be /dev/sda, allways.

Now a more challenging aproach:

Construct a bootloader that knows about disklabels or uuids.
That bootloader will hunt for the disklabel and convert that
to the root= is parameter.

Another possible way might be an initial ramdisk, initrd, that resides in flashmemory,
root=/dev/ramdisk0, which hunts for the right partition and
hands over to that file system. ( IIRC pivotroot )

I haven't yet any exprience with the above two methods.

comment:14 Changed 9 years ago by k.szczesny@…

uhh... stappers,.. you're a smart guy and I appreciate your work but sometimes reading your comments... oh man.
Your easy workaround with the same hardware is exactly what I do. I boot with the same hardware over and over. Every second time I get my usb modem as sda and hdd as sdb, and the other time hdd as sda and usb modem as sdb.

To wrap up first part of you comment, what you wrote is:
best way to make your requirement work is to let go of the requirement.

Thank god, as I said before, you're a smart guy and you made a comeback with the initrd residing in flashmem.
I have to think about it [that means google about it] as it seems the best approach.
Thanks,
Krystian

Add Comment

Modify Ticket

Action
as closed The owner will remain stappers.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.