# [solved]root partition not mounted respecting fstab options

## Esmeraldo

HI,

After an initial Gentoo installation on my arm board, i see that the main ext4 partition is mounted with weird options instead of the ones i've written in the /etc/fstab.

My arm board uses a microSD card instead of a hard disk, the entire OS is installed there. The microSD card is /dev/mmcblk0

my /etc/fstab:

```
# <fs>       <mountpoint>    <type>     <opts>                                                  <dump/pass>

/dev/mmcblk0p1       /       ext4      noatime,data=writeback,commit=600,errors=remount-ro       0       0

```

After booting into the system i see the root partition with totally different options:

```
# cat /proc/self/mounts

/dev/root    /    ext4    rw,relatime,stripe=1024    0 0

(...)
```

As you can see totally different mount options.  :Shocked: 

I can confirm that this line works in Debian Jessie so i'm clueless...

What can i do to make Gentoo obey the fstab mount options?

Thanks for answering   :Sad: 

----------

## krinn

There's a limit to remounting with writeback, i don't know why/where this comes from.

So make sure your kernel is booting directly with the right options so it could remount it with them

See:

```
>umount /dev/sdd1

>mount /dev/sdd1 -n -t ext4 

>mount | grep sdd1

/dev/sdd1 on /mnt/backup type ext4 (rw,noatime,data=ordered)

>LC_ALL=C mount /dev/sdd1 -n -t ext4 -o remount,rw,data=writeback

mount: /mnt/backup not mounted or bad option

       In some cases useful info is found in syslog - try

       dmesg | tail or so.

>LC_ALL=C mount /dev/sdd1 -n -t ext4 -o remount,rw,data=ordered

>umount /dev/sdd1

>LC_ALL=C mount /dev/sdd1 -n -t ext4 -o ro,data=writeback

>mount | grep sdd1

/dev/sdd1 on /mnt/backup type ext4 (ro,noatime,data=writeback)

>LC_ALL=C mount /dev/sdd1 -n -t ext4 -o remount,rw,data=writeback

>mount | grep sdd1

/dev/sdd1 on /mnt/backup type ext4 (rw,noatime,data=writeback)

```

Got it?

- You can always remount it with data=ordered the way you wish

- You can only remount it with data=writeback|journal if it was mount with it first

So you must pass the writeback as kernel parameter, so it will be mount with it, and later remount will works

```
   rootflags=   [KNL] Set root filesystem mount option string
```

You should have something like that:

```
dmesg | grep "command line"

[    0.000000] Kernel command line: clocksource=hpet root=/dev/sdb2 rootflags=data=writeback

```

However i remember an old bug suggesting it should be given thru tune2fs: (ah got it! eheh i'm amazing sometimes: https://bugs.gentoo.org/show_bug.cgi?id=249971#c3)

But the rootflags should works if you trust the manpage.

If you are wondering why it must be done like that, i shall remind you to reread my 1st phrase, you know the part next to the comma

If you are really wondering but how/why... The best answer is:

 *man mount wrote:*   

>        data={journal|ordered|writeback}
> 
>               Specifies  the journaling mode for file data.  Metadata is always journaled.  To use modes other than ordered on the root filesystem, pass the
> 
>               mode to the kernel as boot parameter, e.g. rootflags=data=journal.
> ...

 

----------

## Esmeraldo

A bit of progress:

I've found that i must pass the "ro" kernel parameter instead of "rw" for proper mount the root partition with fstab options.

Updated U-boot script with "ro" instead of the "rw wich used to be":

```
setenv bootargs 'root=/dev/mmcblk0p1 rootfstype=ext4 [b]ro[/b] console=tty1 rootwait consoleblank=0 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32'

(...)
```

Now i can see that the root partition is mounted with SOME of the fstab options, but no all, and with some weird unwanted ones:

```
# cat /proc/self/mounts

/dev/root / ext4 rw,noatime,errors=remount-ro,commit=600,stripe=1024 0 0
```

correct: noatime, errors=remount-ro, commit=600

missing: data=writeback

unwanted: stripe=1024

Edit: it seems that you and me posted at the same time, Krinn. I'll test your info and give back results

Thank you for answering

----------

## s4e8

You'd better set default mount options via tune2fs

tune2fs -e remount-ro -o journal_data_writeback /dev/mmcblk0p1

----------

## Esmeraldo

oooops, i think i know why data write back does not work.

My ext4 filesystem was created with journaling disabled, following the wiki recipe in the website of my device.

```
mkfs.ext4 -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 /dev/sdX1
```

So it seems that choosing a journaling mode for a partition with journaling disabled is... dumb

ooops !  :Embarassed:   :Embarassed:   :Embarassed: 

I feel sorry for making you wate your time   :Embarassed: 

----------

