Dolphin automount with flush option

Everything about X, Gnome, KDE, ... and everything running on it

Dolphin automount with flush option

Postby kdeready » 2018-03-03 14:31

How to set Dolphin to automount removable drives with flush option, so that USB sticks work properly?
kdeready
 
Posts: 10
Joined: 2018-02-27 11:27

Re: Dolphin automount with flush option

Postby sunrat » 2018-03-03 23:17

I have no idea what flush option is, please explain.
Presumably you're using KDE Plasma with Dolphin, go to System Settings, Removable storage, and set automount with the options you want.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2426
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Dolphin automount with flush option

Postby dcihon » 2018-03-04 14:40

dcihon
 
Posts: 233
Joined: 2012-09-23 16:18

Re: Dolphin automount with flush option

Postby kdeready » 2018-03-04 22:39

Flush is a mount option which makes sure that data is immediatly copied to a pendrive instead of residing in cache. Prevents data loss (well, kind of).
Workaround I found is using udevil with it's devmon daemon. It handles automounting and lets you choose mount options.

EDIT: Apparently flush IS a default mount option. It's just that Linux doesn't handle removable devices well. Too bad :(
kdeready
 
Posts: 10
Joined: 2018-02-27 11:27

Re: Dolphin automount with flush option

Postby sunrat » 2018-03-05 07:54

kdeready wrote:Flush is a mount option which makes sure that data is immediatly copied to a pendrive instead of residing in cache. Prevents data loss (well, kind of).
Workaround I found is using udevil with it's devmon daemon. It handles automounting and lets you choose mount options.

EDIT: Apparently flush IS a default mount option. It's just that Linux doesn't handle removable devices well. Too bad :(

I just found it in man mount. It's for fat filesystems only and not default.
flush
If set, the filesystem will try to flush to disk more early than normal. Not set by default.

I never had an issue with usb drives, just make sure to select "Safely Remove" (or sync if on CLI) before removing.
Good you found another way, sounds like it's a better way.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2426
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Dolphin automount with flush option

Postby bw123 » 2018-03-05 09:05

sunrat wrote:I never had an issue with usb drives, just make sure to select "Safely Remove" (or sync if on CLI) before removing.


That's good advice, I have always had trouble if I remove a device when the writes are not finished.
User avatar
bw123
 
Posts: 3267
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Dolphin automount with flush option

Postby dilberts_left_nut » 2018-03-05 09:27

You can also use the 'sync' mount option, but see man mount first.
AdrianTM wrote:There's no hacker in my grandma...
User avatar
dilberts_left_nut
 
Posts: 4867
Joined: 2009-10-05 07:54
Location: enzed

Re: Dolphin automount with flush option

Postby kdeready » 2018-03-05 12:04

sunrat wrote:I just found it in man mount. It's for fat filesystems only and not default.

KDE uses udisksctl command, not mount. Here's a changelog of udisks2:
http://metadata.ftp-master.debian.org/c ... _changelog
It mentions flush only once:
udisks2 (1.99.0+git20120919-1) experimental; urgency=low

* Update to current upstream git head:
(...)
- Mount vfat with "flush" option
(...)

I don't know how to check that though. When I use "udisksctl monitor" it doesn't show mount options used. Same with devmon when used for monitoring only.
sunrat wrote:I never had an issue with usb drives, just make sure to select "Safely Remove" (or sync if on CLI) before removing.
Good you found another way, sounds like it's a better way.

That's something I like about Windows - you don't have to do that. When file transfer window disappears, it means that data has been copied. On Linux it can still take a while (if your pendrive doesn't have a led indicator, you don't know how long). I'm trying to make a fool-proof PC, so it matters.

dilberts_left_nut wrote:You can also use the 'sync' mount option, but see man mount first.

Unfortunately sync cuts write speed by about 80% (on a pendrive I tested). Devmon suggests using flush for fat and sync for ntfs, so it probably works better with ntfs.
kdeready
 
Posts: 10
Joined: 2018-02-27 11:27

Re: Dolphin automount with flush option

Postby dilberts_left_nut » 2018-03-05 17:46

kdeready wrote:
dilberts_left_nut wrote:You can also use the 'sync' mount option, but see man mount first.

Unfortunately sync cuts write speed by about 80% (on a pendrive I tested). Devmon suggests using flush for fat and sync for ntfs, so it probably works better with ntfs.

Well, of course.
What you said you want is every write written to the device immediately, which means lots of writes to a slow device, which is why write caching exists in the first place.
What you are seeing is the actual write speed of your device, which doesn't change with the mount option, it's just masked by the cache saying "job done" before the data is physically written.
You can also adjust the commit time, but that still leaves a window of unwritten data, which you claim not to want.
AdrianTM wrote:There's no hacker in my grandma...
User avatar
dilberts_left_nut
 
Posts: 4867
Joined: 2009-10-05 07:54
Location: enzed

Re: Dolphin automount with flush option

Postby kdeready » 2018-03-05 18:23

Sync doesn't give you the actual speed, it makes things much slower in real terms. The same file copies a few times faster without it.

One thing that makes file transfers much cleaner is setting dirty_ratio and dirty_background_ratio to lower numbers.
To do that you have to add these lines to /etc/sysctl.conf
vm.dirty_background_ratio=5
vm.dirty_ratio=10

These are my settings for now, they depend on the amount of RAM you have. Even Linus Torvalds wrote about it some time ago:
http://yarchive.net/comp/linux/dirty_limits.html
kdeready
 
Posts: 10
Joined: 2018-02-27 11:27


Return to Desktop & Multimedia

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable