5

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?

1 Answer 1

7

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.

6
  • You are right, but why the initial rootfs isn't unmounted, after system boot up?
    – Lenik
    Commented Jul 20, 2012 at 2:29
  • @XièJìléi it can't be. From the kernel documentation initramfs is rootfs: you can neither pivot_root rootfs, nor unmount it. and Most systems just mount another filesystem over rootfs and ignore it. The amount of space an empty instance of ramfs takes up is tiny.
    – phemmer
    Commented Jul 20, 2012 at 3:39
  • @Patrick I've checked some other Linux installs, however, rootfs doesn't show in df output..
    – Lenik
    Commented Jul 20, 2012 at 6:32
  • If the first entry is the initramfs, why does df show the size of the root file system, instead of the size of the initramfs?
    – Marco
    Commented Jul 20, 2012 at 9:24
  • 1
    @marco Because df cant get to the original initramfs, the real root filesystem is on top of it.
    – phemmer
    Commented Jul 20, 2012 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .