TRIM on all supported file systems

asked 2015-06-19 23:38:13 +0200

V10lator gravatar image

Currentls the /usr/sbin/mount-sd.sh script adds "discard" if a vfat or exfat system is detected. Now people are using ext4 or btrfs cause vat is limited and exfat not officially supported but these filesystems are able to TRIM, too. So I would suggest something like this:

    case "${TYPE}" in
    vfat|exfat)
        MOUNT_OPTS="uid=$DEF_UID,gid=$DEF_GID,$MOUNT_OPTS,utf8,flush,discard"
        ;;
    # NTFS support has not been tested but it's being left to please the ego of an engineer!
    ntfs)
        MOUNT_OPTS="uid=$DEF_UID,gid=$DEF_GID,$MOUNT_OPTS,utf8"
        ;;
    # Think about TRIM!
    ext4|btrfs)
        MOUNT_OPTS+=",discard"
        ;;
    esac
    mount ${DEVNAME} $MNT/${UUID} -o $MOUNT_OPTS || /bin/rmdir $MNT/${UUID}

The result should be:

/dev/mmcblk1p1 on /media/sdcard/d742de61-e9be-4618-ad04-40e7e66d7b40 type ext4 (rw,nosuid,nodev,noexec,noatime,dirsync,discard)
edit retag flag offensive close delete

Comments

3

I am not sure if this matters here: https://blog.algolia.com/when-solid-state-drives-are-not-that-solid/. AFAIU Jolla must be sure that the controller for sd card slot implements trim correctly. But I am no expert...

sm-jolla ( 2015-06-20 00:06:56 +0200 )edit