# Specify mount options for /dev/root and rootfs?

## SiliconBadger

I have done a lot of searching on this, and I found some information that is either incomplete, or I just don't understand, and in any event, doesn't address my primary concern about /dev/root and rootfs.  I am trying to mount my nice shiny new SSD with the crucial discard mount option to enable TRIM, yet the line in /etc/fstab where I specify those mount options seems to be ignored.

/dev/sdc1 does not appear in the output of mount, but I do have /dev/root and rootfs showing as mounted on /.  I see that /dev/root is a symlink to /dev/sdc1.  From what I have read, rootfs can simply be ignored, but I cannot find any clear answer on why there is /dev/root.  Also, I cannot find information on how to specify mount options for this.

I am going to try the obvious, which is to add a line for /dev/root in my /etc/fstab, and just hope that it doesn't break something; but I still want to have this posted because in principal, it seems wrong to me to ignore the administrator's input into /etc/fstab, and instead having something else mounted.  At the very least, it seems the system should inherit the mount options.

Thoughts, anyone?

----------

## Ant P.

/dev/root is whatever the bootloader says the root fs is. root options get set in there too, i.e. "rootflags=discard".

If you're using ext4, just use tune2fs -o discard to turn it on permanently.

----------

## wcg

/dev/root is just an alias set up by udev. I do not

know what uses it. /dev/sdc1, the real device file

aliased by /dev/root, will be mounted with whatever

options you specify for /dev/sdc1 in /etc/fstab. If

the system is not mounting /dev/sdc1 on / at boot,

the problem is some other problem than /dev/root.

Assuming that you use grub, what is your grub.conf

kernel command for that kernel? Do you use an initrd?

If so, does the file refered to by the initrd command in

grub.conf for that kernel exist in /boot? Does the kernel

referred to in the kernel command exist in /boot?

----------

## Massimo B.

Interesting. So can I set all mount options in fstab only or do I need to specify these already by the bootloader?

```
LABEL=root   /   ext4   noatime,nodiratime,nouser_xattr,barrier,data=writeback,nobh,commit=100   0 1
```

```
title Gentoo (current)

root (hd1,1)

kernel /boot/vmlinuz root=/dev/sdb2 video=intelfb:mode=1920x1200-32@60 splash=verbose,fadein,kdgraphics,theme:livecd-2007.0 quiet fbcon=font:ProFont6x11 CONSOLE=/dev/tty1

initrd /boot/fbsplash

```

The options of fstab seem to be applied. The only thing I wonder that the commit is applied twice and I'm not sure why and which one has precedence:

```
$ mount | grep " / "

rootfs on / type rootfs (rw)

/dev/root on / type ext4 (rw,noatime,nodiratime,nouser_xattr,barrier,data=writeback,nobh,commit=100,commit=0)
```

Then still the question why / is mentioned twice?

PS.: This should have something to do with /etc/mtab and /proc/mounts? Is it right that these files are different?

```
$ diff /etc/mtab /proc/mounts

2c2

< /dev/root / ext4 rw,noatime,nodiratime,nouser_xattr,barrier,data=writeback,nobh,commit=100,commit=0 0 0

---

> /dev/root / ext4 rw,noatime,nodiratime,nouser_xattr 0 0

...
```

----------

## Circuitsoft

What is Rootfs?

If you want it to obey your fstab, add "ro" to the kernel command line. That will cause the kernel to mount the root fs read-only, and cause userspace apps to use the flags from fstab to remount it read-write.

----------

## Massimo B.

 *Circuitsoft wrote:*   

> If you want it to obey your fstab, add "ro" to the kernel command line. That will cause the kernel to mount the root fs read-only, and cause userspace apps to use the flags from fstab to remount it read-write.

 But my fstab already is considered and applied for the root filesystem.

But you mean I would add "ro" into that line "kernel /boot/vmlinuz..." in order to only apply fstab options to the root filesystem?

----------

