Debian – Why rootfs is mounted multiple times

debianfstabmount

Here you can see two devices are mounted as root:

$ df
Filesystem                                             1K-blocks      Used Available Use% Mounted on
rootfs                                                  29221788  18995764   8761244  69% /
udev                                                       10240         0     10240   0% /dev
tmpfs                                                     203260      2192    201068   2% /run
/dev/disk/by-uuid/1d8879f2-9c47-4a72-9ef4-a6ecdd7a8735  29221788  18995764   8761244  69% /
tmpfs                                                       5120         0      5120   0% /run/lock
tmpfs                                                     406516       376    406140   1% /tmp
tmpfs                                                     406516        72    406444   1% /run/shm
/dev/sda2                                               29225884  15019636  12741264  55% /home
/dev/sda3                                              226881528 191247596  24275680  89% /opt
...

However, I didn't specify UUID in /etc/fstab:

proc            /proc           proc    defaults        0       0
LABEL=debian    /               ext4    errors=remount-ro 0       1
LABEL=istore    /mnt/istore ext4    defaults    0   0
LABEL=home  /home           ext4    defaults        0       2
...

I'd like to see mount info in "/dev/xxx" rather then "/dev/disk/by-uuid/…". Though mount by UUIDs have many advantages, but I prefer to the old style… It's also weired why there are two rootfs mount?

Best Answer

This is a side effect of how the debian initramfs operates. Initially the kernel creates a tmpfs for the root, and unpacks the initramfs, which is a compressed cpio archive, there. The programs and scripts in the initramfs mount the real root device and then chroot there. Simply ignore the first entry that lists the filesystem as rootfs, as that is just the initramfs. It is the other one that is your real root filesystem.

Since /etc/fstab is in your root fs, it can not be consulted to mount your root fs, so this is done via kernel command line arguments passed by the boot loader. If you are using grub, it uses the UUID by default to avoid problems if the drives happen to be enumerated in a different order. You can edit /etc/default/grub to change this behavior, but it is not a good idea.

Related Question