You are not logged in.

#1 2012-06-13 11:44:50

From: Germany
Registered: 2010-11-14
Posts: 86

[SOLVED] root mounted without discard option

Hey guys,

yesterday I moved my Arch install from HDD to my new Samsung 830 SSD (yes, I moved with `cp -a`). After some problems with grub and harddrive order, I managed to get the system working. I'm running 3.4.2-1-ARCH Kernel with Grub Legacy from MBR. Here is my new `etc/fstab`:

/dev/sdc1  /boot  xfs  defaults,noatime,discard  0  2
/dev/sdc2  /  xfs  defaults,noatime,discard  0  1
/dev/sdb2  /swap  swap  defaults  0  0
/dev/sdb1  /media/hdd  ext4  defaults,rw,nodiratime,relatime  0  2
/media/hdd/home  /home  none  bind  0  0
/media/hdd/var  /var  none  bind  0  0

I have my /boot and / partition on the SSD (sdc) and binding /home and /var from one of my HDD (sdb). sda doesn't matter in here. When the system is running, this is my `/etc/mtab`:

/dev/sdc2 / xfs rw,relatime,attr2,noquota 0 0
/dev/sdc1 /boot xfs rw,noatime,attr2,discard,noquota 0 0
/dev/sdb1 /media/hdd ext4 rw,nodiratime,relatime,data=ordered 0 0
/dev/sdb1 /home ext4 rw,relatime,data=ordered 0 0
/dev/sdb1 /var ext4 rw,relatime,data=ordered 0 0

As you might see, the /boot partition is probably mounted with the discard option, but / isn't. noatime is also ignored. Same filesystem, same mount options in fstab. Maybe the kernel don't remount / after getting access to it. So I tried to remount /, but it only use the noatime, discard still be ignored:

# sudo mount / -o remount,discard,noatime
# cat /etc/mtab | grep sdc2
/dev/sdc2 / xfs rw,noatime,attr2,noquota 0 0

I can run `fstrim` on both partitions without errors:

# sudo fstrim -v / 
/: 38736936960 bytes were trimmed
# sudo fstrim -v /boot
/boot: 185688064 bytes were trimmed

So my system seems to support it. While googling I read to use `dmesg | grep discard` to determine if discard is enabled, but it don't give any output at mine. I'm quiet not sure if discard is not enabled or it is simply not shown in mtab. Maybe a bug?

I appreciate all help, Thanks in advance.

Greetz Corubba

PS: I think about also moving the swap partition to the SSD. The `man swapon` mention a discard option for swap. Does anyone have experience with that?

EDIT: Marked as solved.

Last edited by Corubba (2012-06-13 15:28:37)


#2 2012-06-13 15:28:07

From: Germany
Registered: 2010-11-14
Posts: 86

Re: [SOLVED] root mounted without discard option

I solved this topic myself. The discard option is not able to set with a remount, so it has to be used for the first mount time (in case of / it is when the rootfs is mounted by kernel at boot time). The key is to give the discard mount option as kernel parameter using rootflags. This is what the entry in my menu.lst looks like now:

# (0) Arch Linux
title  Arch Linux
root   (hd0,0)
kernel /vmlinuz-linux root=/dev/sdc2 rootflags=discard ro
initrd /initramfs-linux.img

the noatime option will be set when the rootfs is remounted rw, so I will leave this in my fstab.

And it seems, the TRIM support for swap can easily be enabled by using discard as mount option in fstab for the swap partition.

/dev/sdc3  none  swap  defaults,discard  0  0


Board footer

Powered by FluxBB