I am developing a device that will run Linux as its operating system. The device is a small form factor X86 device with a flash drive exposed as a SATA-device. So it is not very dissimilar from any other PC running Linux.

For several good reasons I am building my own "distribution", instead of using an existing one.

What confuses me is how mount/umount of the root file system is handled. I boot my kernel with the commandline "root=/dev/sda1 rw" which works fine. But everytime I do poweroff or reboot Busybox complained about no /etc/fstab, so I decided to build one.

Should I have an entry for my root file system? It seems like this is shadowed by the rootfs anyway. I.e. if I have the fstab entry "/dev/sda1 / ext2 1 1" mount still reports

  rootfs on / type rootfs (rw)
  /dev/root on / type ext2 (rw,relatime,errors=continue)

My questions are:

  1. Do I need to worry? Will the drive be correctly unmounted by the kernel on poweroff/reboot?
  2. If I want to perform file system checking on boot, can I do that without resorting to an initrd?

At the startup the Kernel needs the root only for reading the init process (ex. /init).

During this step the root MUST NOT be mounted as read-write, it could cause errors.

The read-write root's mount is performed by the /etc/fstab.

If you have the necessity to mounts a filesystem without an /etc/fstab, use the -n option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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