8

My USB drive is currently automounted correctly under Gnome (Ubuntu 18.04), but I want to set the "noatime" option at mount.

I know I can do this via the Gnome "disks" untility, but I prefer to document in code what I did to set up my system, so I'm looking for the command-line way to do this.

5
  • 1
    The following links may help you, Auto mount, and change mount points on login and Mount NTFS partition in a USB drive with custom permissions and owner -- Add the mount option noatime among the other mount options (in a comma separated list).
    – sudodus
    May 19, 2018 at 18:04
  • These will play nice with the user-mount that Gnome does on my behalf?
    – retorquere
    May 19, 2018 at 18:11
  • What I suggest is to mount the drive either via a line in the file /etc/fstab or a command line with mount. The same options apply in both cases, and if already mounted, the system should not mount it again. What file systems are there on the drive? How is it mounted now? You can find out by looking into the file /etc/mtab (when it is mounted).
    – sudodus
    May 19, 2018 at 18:24
  • It's mounted as /dev/sdb1 /media/emile/ShittySSD ext4 rw,nosuid,nodev,noatime,block_validity,discard,delalloc,nojournal_checksum,barrier,user_xattr,acl 0 0 but wouldn't adding it to fstab preclude a user mount?
    – retorquere
    May 20, 2018 at 22:34
  • 1
    If you add a partition to fstab, it will normally be mounted automatically at boot, and there will be problems, if the partition in not available (if the USB drive is not plugged in). But you can use the mount option noauto, it will not be automatically mounted, yet the mount options are there and the operating system is ready to mount it, whenever you want (and have the USB drive connected). It is enough to specify the device or mount point for example sudo mount /dev/sdb1 or sudo mount /mnt/sssd (if you have made and specified the mount point /mnt/sssd).
    – sudodus
    May 21, 2018 at 5:06

2 Answers 2

3

First run df to see what device your external drive is, for example, for me the appropriate line looks like this:

/dev/sdc1              4883769340 2392246688 2491522652  49% /media/drew/LACIE-5GB

/media/drew/LACIE-5GB is where the disk got mounted and the appropriate device is /dev/sdc1 - this can change depending on how many external drives you have and in what order they were connected.

blkid /dev/sdc1
/dev/sdc1: LABEL="LACIE-5GB" UUID="703C31971BEBAA7E" TYPE="ntfs" PTTYPE="dos" PARTLABEL="LACIE-5GB" PARTUUID="6afdadd9-39ce-4875-b747-82cae734ae02"

The UUID is 703C31971BEBAA7E

So one can put a line like this into /etc/fstab:

UUID=703C31971BEBAA7E   /media/drew/LACIE-5GB   ntfs    defaults,noauto,noatime,uid=1000,gid=1000,umask=0000,fmask=0111      0       0

Note that noauto is important - if the drive is not connected on startup and that option is not present, the boot halts and needs to be manually restarted. uid=1000,gid=1000,umask=0000,fmask=0111 are just options for NTFS not to make every file executable (which prompts Nautilus to ask if a file is to be displayed or run when I try to read a txt file, for example). noatime is the option originally requested.

2
  • isn't that a typo? Don't you mean "fstab" instead of "fstav"?
    – Richard T
    Sep 11, 2022 at 18:30
  • yes, it is, corrected.
    – sup
    Sep 12, 2022 at 19:53
0

This may not be the perfect solution, but I created an /etc/udisks2/mount_options.conf file with just:

[defaults]
defaults=noatime

Running cat /proc/mounts shows my removable drives mounted with noatime. This is great for me since I'm convinced defaulting to noatime is a step forward.

The udisks man page is useful as well as https://wiki.archlinux.org/title/Udisks#Udisks (the archlinux wiki is consistently helpful).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .