Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Dolphin automount with flush option

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
kdeready
Posts: 10
Joined: 2018-02-27 11:27

Dolphin automount with flush option

#1 Post by kdeready »

How to set Dolphin to automount removable drives with flush option, so that USB sticks work properly?

User avatar
sunrat
Administrator
Administrator
Posts: 6458
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 472 times

Re: Dolphin automount with flush option

#2 Post by sunrat »

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!

dcihon
Posts: 279
Joined: 2012-09-23 16:18
Been thanked: 3 times

Re: Dolphin automount with flush option

#3 Post by dcihon »


kdeready
Posts: 10
Joined: 2018-02-27 11:27

Re: Dolphin automount with flush option

#4 Post by kdeready »

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 :(

User avatar
sunrat
Administrator
Administrator
Posts: 6458
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 472 times

Re: Dolphin automount with flush option

#5 Post by sunrat »

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
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Dolphin automount with flush option

#6 Post by bw123 »

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.
resigned by AI ChatGPT

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5346
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 13 times
Been thanked: 66 times

Re: Dolphin automount with flush option

#7 Post by dilberts_left_nut »

You can also use the 'sync' mount option, but see man mount first.
AdrianTM wrote:There's no hacker in my grandma...

kdeready
Posts: 10
Joined: 2018-02-27 11:27

Re: Dolphin automount with flush option

#8 Post by kdeready »

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.

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5346
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 13 times
Been thanked: 66 times

Re: Dolphin automount with flush option

#9 Post by dilberts_left_nut »

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...

kdeready
Posts: 10
Joined: 2018-02-27 11:27

Re: Dolphin automount with flush option

#10 Post by kdeready »

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

Post Reply