You are not logged in.

#1 2014-02-05 12:48:21

Registered: 2009-04-16
Posts: 168

Automatically mounting USB storage with sync option

I'm trying to mount my USB flash drives with the sync option automatically, in hopes that it will provide me with more accurate progress displays when copying large files to them with Nautilus.

My current approach is to try and use an appropriate udev rule. Currently, I have this:

$ cat /etc/udev/rules.d/10-sync-usb-media.rules 
ACTION=="add", BUS=="usb", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="rw,suid,dev,exec,auto,nouser,sync,relatime"

I took the mount options from defaults, and just modified the async one to say sync.

This doesn't work, when I look at the mount options used for my flash drive, it still isn't synchronized:

$ mount | grep USBKey                             
/dev/sdd1 on /run/media/rob/USBKey type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)

What would be the right way to get the result I desire?

smile neutral sad big_smile yikes wink hmm tongue lol mad roll cool


#2 2014-02-05 13:04:29

Registered: 2009-05-06
Posts: 25,440

Re: Automatically mounting USB storage with sync option

Does it work if you mount it by hand? Do you get more accurate progress displays?


#3 2014-02-05 13:08:53

Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 10,712

Re: Automatically mounting USB storage with sync option

Please search before posting, this has been covered a lot of times in the past. The general consensus is that sync is bad and slow, and you should use flush instead.

Also, don't use udev rules. Use udisks, or a wrapper. … c+transfer … ge_Devices

Mobo: MSI MEG B550 UNIFY // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.


#4 2014-02-06 05:59:17

Registered: 2009-08-28
Posts: 3,058

Re: Automatically mounting USB storage with sync option

BTW if you really want the sync option, you can use devmon (part of udevil package) to accomplish this. It includes a "--sync" or "-s" flag.


Board footer

Powered by FluxBB