[Cialug] external hdd, laptop, clean unmounts

Daniel A. Ramaley daniel.ramaley at DRAKE.EDU
Mon Jan 7 13:54:52 CST 2008


If the filesystem is ext3 (or perhaps other journaling file systems) 
would setting the journal_data mount option help? See tune2fs(8) for 
more info on that option. Basically, normally only the metadata is 
journaled but with journal_data everything is journaled. I've not 
tested it, but i believe the end result is that the filesystem has less 
risk of corruption when unexpectedly unmounted at the expense of being 
a bit slower on writes.

I'd enable both "sync" and "journal_data" and do some testing to see how 
easy it is to end up with a corrupted filesystem. By testing, i mean 
try copying a large directory of files to the drive and yank it in the 
middle of the copy. When remounted, is anything corrupt? Were at least 
some of the files copied successfully? If the filesystem is not 
corrupted, then it is probably reasonably safe to enable those mount 
options and use the disk as you intend to: feel free to unplug it as 
long as the activity light is off and you haven't written anything to 
it recently (within a few seconds should be safe with "sync" enabled).

On Monday 07 January 2008 09:36, Josh More wrote:
>In theory, you could modify the autofs config and add "sync" as a
> mount option.
>
>If I understand things correctly, one of the reasons that you get
>corruption is that most filesystem writes are done asynchronously, and
>when you power down without unmounting, all writes are not necessarily
>performed in time.  Using "sync" overrides that default (which is
>"async") and should give you improved data integrity at the cost of a
>reduction in speed.
>
>It is, however, not a magic bullet.  If you pull the cable while the
>drive is updating inodes and the like, you will still have problems.
>Consider this a mitigation strategy only.
>
>
>
>
>-Josh More, RHCE, CISSP, NCLP, GIAC
> morej at alliancetechnologies.net
> 515-245-7701
>
>>>> "Matthew Nuzum" <newz at bearfruit.org> 01/07/08 9:22 AM >>>
>
>I now have a USB hard drive for doing backups and storing less
>frequently
>used data. It needs to be plugged into the wall and for various
> reasons I
>don't want to carry it around with me whenever I want to work in
>another
>room/building.
>
>Right now, my USB hub has my keyboard, mouse and laser printer plugged
>into
>it. The beauty is that none of those things complain if I just unplug
>the
>cord and walk away. I'd like to plug my hdd into the hub as well.
>
>However, the hdd is not happy if I yank the cord and walk away. I get
>the
>nasty "Unsafe device removal" warning box and if I do it too many
>times,
>presumably I'll lose data too. I tend to move around a lot. Presumably
>I'll
>move around far more frequently than I'll use the ext hdd.
>
>Anyone know a way to set things up so that I can just unhook without a
>second thought?
>
> * Goal 1: Not loose data, assuming the light on the front of the
> drive has
>stopped blinking before I unplug
> * Goal 2 (optional): Not get the "unsafe device removal" warning

-- 
------------------------------------------------------------------------
Dan Ramaley                            Dial Center 118, Drake University
Network Programmer/Analyst             2407 Carpenter Ave
+1 515 271-4540                        Des Moines IA 50311 USA


More information about the Cialug mailing list