From: Alexander Batischev on 6 May 2010 05:50 Hi, On my netbook I'm using automatic USB sticks mount through udev rules, and I already used to running 'sync' command before unplugging stick, so no data will be lost. But if I have few sticks inserted and some information copying on one of them, if I run 'sync' I have to wait while copying ends, because: a) sync command drops cache on disk, but copying process fill it again; sync will work until all the caches are dropped to disks b) I can't unplug stick when it stops to flash because I can't be sure that there are no more parts of cache needed to be flushed on that disk. So here is my question - how can I run sync for only one device? With best regards, Alexander Batischev -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/p2u28c1d5ea1005060246p3434d45dy6b9ca5b6d34a08de(a)mail.gmail.com
From: Camaleón on 6 May 2010 09:20 On Thu, 06 May 2010 12:46:19 +0300, Alexander Batischev wrote: > On my netbook I'm using automatic USB sticks mount through udev rules, > and I already used to running 'sync' command before unplugging stick, so > no data will be lost. But if I have few sticks inserted and some > information copying on one of them, if I run 'sync' I have to wait while > copying ends, because: > > a) sync command drops cache on disk, but copying process fill it again; > sync will work until all the caches are dropped to disks Dunno if this would fit your needs, but there is a "sync" option for mount points you can use to ensure all removable devices (or only the ones you select) get mounted with "-o sync" flag. But I would be a bit reluctant to use that, because as per "man mount" page that flag can shorten the life of flash drive based devices with a limited number of write operations. > b) I can't unplug stick when it stops to flash because I can't be sure > that there are no more parts of cache needed to be flushed on that disk. > > So here is my question - how can I run sync for only one device? To avoid data loss you have to "umount" the device first (or just "eject" if that options is available in your system). Umount/eject operation should care the data is correctly stored in the media before powering off or unplugging the device. Greetings, -- Camaleón -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/pan.2010.05.06.13.17.15(a)gmail.com
From: Camaleón on 6 May 2010 10:40 El 2010-05-06 a las 16:36 +0300, Alexander Batischev escribió: (resending to the list) > Hi, and thanks for response! > > On 6 May 2010 16:17, Camaleón wrote: > >> On my netbook I'm using automatic USB sticks mount through udev rules, > >> and I already used to running 'sync' command before unplugging stick, so > >> no data will be lost. But if I have few sticks inserted and some > >> information copying on one of them, if I run 'sync' I have to wait while > >> copying ends, because: > >> > >> a) sync command drops cache on disk, but copying process fill it again; > >> sync will work until all the caches are dropped to disks > > > > Dunno if this would fit your needs, but there is a "sync" option for > > mount points you can use to ensure all removable devices (or only the > > ones you select) get mounted with "-o sync" flag. > > > > But I would be a bit reluctant to use that, because as per "man mount" > > page that flag can shorten the life of flash drive based devices with a > > limited number of write operations. > > Yes, that's why all USB sticks are mounted with async option and > that's a reason to use 'sync' before unplugging them. O.k. > >> b) I can't unplug stick when it stops to flash because I can't be sure > >> that there are no more parts of cache needed to be flushed on that disk. > >> > >> So here is my question - how can I run sync for only one device? > > > > To avoid data loss you have to "umount" the device first (or just "eject" > > if that options is available in your system). Umount/eject operation > > should care the data is correctly stored in the media before powering off > > or unplugging the device. > > Well, yes, that's right, but I don't unmount sticks by myself — udev > does that when I unplug USB device. Let me describe how automounting > implemented so it would be more clear to you. > > When I put my flash drive into USB port, udev recognizes that, checks > drive for filesystem type, and mount it if it's FAT or NTFS. After > that I can work with mounted stick. Right. > When I unplug stick, udev unmounts it from mountpoint. Pay attention > to moment of unmount - it happens *after* unplugging, so no cache can > be flushed as far as device is already disconnected. > > I though about running umount /mnt/sd[a-z] before unplugging, but then > decided to ask for a better way. If I won't find it, umount will be > the solution. So, any other options? I never do that way. I always first "umount" the device and then, I remove the stick, but not the reverse. Removable media has to be done that way, to prevent data loss or flash drive damage, or that is what manufacturers say :-? Greetings, -- Camaleón -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/20100506142143.GA11722(a)stt008.linux.site
From: Alexander Batischev on 6 May 2010 11:10 >> When I unplug stick, udev unmounts it from mountpoint. Pay attention >> to moment of unmount - it happens *after* unplugging, so no cache can >> be flushed as far as device is already disconnected. >> >> I though about running umount /mnt/sd[a-z] before unplugging, but then >> decided to ask for a better way. If I won't find it, umount will be >> the solution. So, any other options? > > I never do that way. I always first "umount" the device and then, I > remove the stick, but not the reverse. Removable media has to be done > that way, to prevent data loss or flash drive damage, or that is what > manufacturers say :-? Of course, "umount, then remove" is the normal way to remove USB stick (and any other storage). But as far as main idea of automounting is "easy (un)plug" (in my opinion at least), we have little weird but working principle "sync, then unplug, and udev will carry out everything else". As I already said, it's really weirds, but it works. But all you said made me hard thinking about the way I mount and unmount my removable media. Maybe I should forget about sync and use 'umount /mnt/sd[a-z]' instead, or even write little script which will ask me which device I want to unmount⦠Dunno. But thanks for sharing your thoughts with me! P.S. Camaleón, please forgive me for sending previous mail directly to you, not to the list. I think it's time to drop GMail web interface and switch back to local email client⦠With best regards, Alexander Batischev -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/t2k28c1d5ea1005060804l6bb90152s5ff573e00b58b6ec(a)mail.gmail.com
From: Camaleón on 6 May 2010 12:00 On Thu, 06 May 2010 18:04:41 +0300, Alexander Batischev wrote: (...) >> I never do that way. I always first "umount" the device and then, I >> remove the stick, but not the reverse. Removable media has to be done >> that way, to prevent data loss or flash drive damage, or that is what >> manufacturers say :-? > > Of course, "umount, then remove" is the normal way to remove USB stick > (and any other storage). But as far as main idea of automounting is > "easy (un)plug" (in my opinion at least), we have little weird but > working principle "sync, then unplug, and udev will carry out everything > else". As I already said, it's really weirds, but it works. Mmm, I still fail to see your point for performing a "sync" operation. Umount won't allow the device to be unmounted if it's busy (writing/ reading data) so it's a single and safer operation (umount -> unplug). > But all you said made me hard thinking about the way I mount and unmount > my removable media. Maybe I should forget about sync and use 'umount > /mnt/sd[a-z]' instead, or even write little script which will ask me > which device I want to unmount… Dunno. But thanks for sharing your > thoughts with me! You're welcome :-) > P.S. Camaleón, please forgive me for sending previous mail directly to > you, not to the list. I think it's time to drop GMail web interface and > switch back to local email client… No problem. I also have a Gmail account and used webmail interface not so time ago, so I am aware of the annoyance to have to delete the OP's e-mail address when replying in some lists... I switched to Mutt (for private e-mails) and use a news reader (for mailing lists). No more webmail O:-) Greetings, -- Camaleón -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/pan.2010.05.06.15.53.49(a)gmail.com
|
Next
|
Last
Pages: 1 2 Prev: How to schedule for a repeated task? Next: Debian Etch n half hd-media |