Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

My kernel command line looks like this:

root=31:0 ro noinitrd console=ttyS0,115200 root=/dev/mtdblock2 rootfstype=squashfs

I think the first root entry identifies a disk by its major and minor device number and the second entry identifies it by its name. I can confirm that the rootfs is indeed on /dev/mtdblock2 but I don't know how to interpret 31:0.

share|improve this question
add comment

2 Answers

up vote 8 down vote accepted

Different modules behave differently when you provide the same option multiple times. I know you can say console= multiple times, and you get multiple consoles (we use it for machines with main consoles on both their framebuffers and serial port).

However, you can only have one root partition, so root= almost certainly overwrites the previous value seen, almost certainly in a left-to-right fashion. This is corroborated by the kernel source, in init/do_mounts.c, function root_dev_setup() is responsible for acting on the root= option, and all it does is store the parameter key in a variable. The bootparam root=31:0 is overridden by root=/dev/mtdblock2, or at least that's the case in the 2.6.25 source tree I just checked.

By the way, if you're competent with C, the function name_to_dev_t() in the same file is responsible for parsing the value of root=, and is very enlightening!

The x:y notation is standard Unixism for major:minor, which is the way Unices identify devices. Traditionally, major was an 8-bit number identifying the driver for the hardware, and minor was an 8-bit number identifying the device itself. There are two namespaces for the major numbers: character devices and block devices. You can see both by typing cat /proc/devices, and you can see what's currently active by saying ls -la /dev. Here's an example:

ls -la /dev/zero /dev/sda
brw-rw---- 1 root disk 8, 0 Jan 12 22:01 /dev/sda
crw-rw-rw- 1 root root 1, 5 Jan 12 22:01 /dev/zero

The first column identifies the driver type (b for block, c for character). The two columns to the left of Jan are the major and minor numbers in major, minor format.

You can give root= any block device independent of its name using the major:minor notation.

The full list of device numbers is in your kernel source tree, under Documentation/devices.txt. 31:0 seems to refer to /dev/rom0, the first ROM card on the system.

share|improve this answer
This is a really good answer going well bejond what was asked. Is there someone willing to start a bounty for this? –  Nils Jan 13 '12 at 20:59
Thanks for the awesome answer! As a junior kernel developer, the source details were especially enlightening. –  Atilla Filiz Jan 16 '12 at 8:58
add comment

Use labels (root=LABEL=...) to mount the file system with a label instead of a device name.


share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.