Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Unmounting usb drive without losing changes
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
dedrop
n00b
n00b


Joined: 07 Jun 2004
Posts: 41
Location: Urbana, IL

PostPosted: Wed Nov 17, 2004 7:55 pm    Post subject: Unmounting usb drive without losing changes Reply with quote

I've got auto-mounting and unmounting of my usb drive working with udev, but I've run into a problem: because the changes I make to the drive while it's mounted don't seem to be submitted until umount is run, and my udev auto-unmounting script isn't triggered until the device is already pulled out, I keep losing all the my changes.

Since I can't very well expect my computer to presentiently know when I'm about to pull the drive and run umount, is there some option to force the file system changes to happen immediately? I considered the sync option in mount, but the man page says it doesn't apply to vfat.
Back to top
View user's profile Send private message
zeekec
n00b
n00b


Joined: 24 Feb 2004
Posts: 56
Location: Athens, GA, USA

PostPosted: Wed Nov 17, 2004 7:59 pm    Post subject: Check out the sync option. Reply with quote

I think that the "sync" mount option will cause the system to immediately write to te disk rather than caching the write. It will reduce the performance.

Erik
Back to top
View user's profile Send private message
dedrop
n00b
n00b


Joined: 07 Jun 2004
Posts: 41
Location: Urbana, IL

PostPosted: Wed Nov 17, 2004 8:06 pm    Post subject: Reply with quote

Yeah, I figured as much. But as I mentioned, the man page has the following:

"the sync option today has effect only for ext2, ext3 and ufs."

I tried adding the option anyway and, sure enough, the problem persisted.
Back to top
View user's profile Send private message
zeekec
n00b
n00b


Joined: 24 Feb 2004
Posts: 56
Location: Athens, GA, USA

PostPosted: Wed Nov 17, 2004 8:19 pm    Post subject: Oops Reply with quote

Oops. I missed the part about sync. :oops:

A dirty hack, but you could set up a script to run "sync" every so often until the device is removed. Performance would really suffer then.

Erik
Back to top
View user's profile Send private message
dedrop
n00b
n00b


Joined: 07 Jun 2004
Posts: 41
Location: Urbana, IL

PostPosted: Wed Nov 17, 2004 9:30 pm    Post subject: Reply with quote

hehe. True. At that point, I'd rather just trust myself to umount manually before pulling the drive out. It's surprising that I haven't been able to find similar threads, since one would think this would be a common problem.
Back to top
View user's profile Send private message
zeekec
n00b
n00b


Joined: 24 Feb 2004
Posts: 56
Location: Athens, GA, USA

PostPosted: Wed Nov 17, 2004 9:34 pm    Post subject: Reply with quote

I have the feeling that without implementing the sync option for vfat there is no good solution.

Good luck in your quest.

P.S. You could always format them with an ext2 file system.
Back to top
View user's profile Send private message
zeekec
n00b
n00b


Joined: 24 Feb 2004
Posts: 56
Location: Athens, GA, USA

PostPosted: Wed Nov 17, 2004 9:41 pm    Post subject: Automount? Reply with quote

If your using an automounter you should be able to have auto unmount. This could reduce the danger of for coruption.

http://www.hermann-uwe.de/pendisk.php

Erik
Back to top
View user's profile Send private message
zeekec
n00b
n00b


Joined: 24 Feb 2004
Posts: 56
Location: Athens, GA, USA

PostPosted: Wed Nov 17, 2004 10:00 pm    Post subject: Supermount to the recue. Reply with quote

Supermount appears to guarantee that the disks buffers are flushed before the command returns. (and it's supposedly included in the Gentoo kernel sources)

http://supermount-ng.sourceforge.net/

I'm going to try it tonight on my home system.

Erik
Back to top
View user's profile Send private message
fafhrd
Retired Dev
Retired Dev


Joined: 14 May 2002
Posts: 431
Location: Williamstown, MA

PostPosted: Thu Nov 25, 2004 8:18 am    Post subject: Reply with quote

Unless the system is normally mounted read-only, in some way, you must unmount the filesystem before pulling the device out. This is no different than if power were to die for your system, the mounted r/w filesystems could possibly have corruption.

This behavior is across all operating systems -- it's just a side
effect of usb drives.

However, sending signal USR1 to automount will make automount try to umount all the filesystem's it can. However, it's only able to be run as root, of course. So, assuming you have sudo installed (what, you don't?! ;-)), you can add:

ALL ALL=NOPASSWD:/usr/bin/killall -USR1 automount

using 'visudo'.

Then you can alias this command, make a script, launch it from your gui or a terminal, etc etc.

....although....another disturbing possibility is that some filesystems let you store the journal on a different device...possibly, just possibly, but no gaurantee, you can store the journal for the usb drive on your main computer....but this si not something that I would personally do or recommend to anyone ;-)
_________________
jñanam bandha
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum