1 |
On Sun, August 30, 2009 23:26, Alex Schuster wrote: |
2 |
> Jesús Guerrero writes: |
3 |
> |
4 |
> |
5 |
>> Then they wonder why the heck |
6 |
>> the file is not where it should be. I guess they never heard of cached |
7 |
>> writes. |
8 |
>> |
9 |
>> The correct thing to do is of course to umount it before, |
10 |
>> and then unplug it or whatever. |
11 |
> |
12 |
> I do so, it makes me feel better, but I wonder whether it is _really_ |
13 |
> necessary. |
14 |
|
15 |
It is. Nothing can guarantee that the data has been dumped to the disk |
16 |
unless you umount it first. You can reduce the chances of losing |
17 |
information by waiting before removing it. But if the system is loaded |
18 |
the writes can be deferred to a later time, when the system is idle. |
19 |
This can be partially mitigated by using the "sync" mount option, as |
20 |
you say below. :) |
21 |
|
22 |
Of course then the performance will drop, and the i/o scheduler will |
23 |
not have a chance to work as usual either because i/o ops will not be |
24 |
queued, which is the bad part of the deal. |
25 |
|
26 |
|
27 |
> I see Windows users do this all the time, without any problem |
28 |
> yet. Of course, the wait a little after writing to it, but a few seconds |
29 |
> after the blinking stops seem to be enough. |
30 |
|
31 |
Lucky guys. That, or when the file is not on the drive they come back |
32 |
and copy it again without you noticing it. This happens lots of times. |
33 |
I've seen it and I'll continue to see it as long as users don't |
34 |
understand what's going under the hood. That's what the safe removal |
35 |
feature in Windows is about, it's not there just to decorate your |
36 |
try, it exists for a reason. |
37 |
|
38 |
> And people are lazy, |
39 |
|
40 |
Yes, I am as well. But when integrity matters you really want to umount |
41 |
or at least sync before unplugging. I am a lazy guy, lazy like hell, but |
42 |
I always fasten my seat belt when I am going to drive. ;) |
43 |
|
44 |
> The |
45 |
> udev mouting rule is nice, but it leaves a lot of mounts when plugging in |
46 |
> and out repeatedly. |
47 |
|
48 |
Mmmm, I am not sure I follow you. If you use a rule as described above |
49 |
you can remove the mount and even the mount point when the device is |
50 |
detached. Is not that what you mean? |
51 |
|
52 |
> When the system is mostly idle, I guess the writing to the stick would |
53 |
> not be delayed for a long time, so this should be quite safe. At least if |
54 |
> the data is not that important. And if there are no writes, I see no |
55 |
> problem at all. |
56 |
|
57 |
If you don't have a problem with the chance to lose files that's ok. I |
58 |
just thought I'd point it out just in case, because the chance is there. |
59 |
A write operation can be deferred for a number of reasons. That's why |
60 |
"sync" (both as a command and as a mount option) was invented in first |
61 |
place. |
62 |
|
63 |
> There also is the sync option to mount, it should not be used on media |
64 |
> with limited number of write cycles, but I also guess that for my purposes |
65 |
> this would not matter. |
66 |
|
67 |
Nowadays this shouldn't matter too much. The life cycle of ssd devices |
68 |
has been greatly expanded, and they also do some kind of balancing so |
69 |
all the blocks get the same usage. Even journal fs's shouldn't be much |
70 |
of a problem with any recent flash device. |
71 |
|
72 |
-- |
73 |
Jesús Guerrero |