Gentoo Archives: gentoo-user

From: Grant Edwards <grant.b.edwards@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] OT: cleanup after USB backup drive unplugged?
Date: Thu, 11 Jan 2018 16:42:49
Message-Id: p3841j$tfr$1@blaine.gmane.org
1 [This has nothing to do specifically with Gentoo.]
2
3 What cleanup actions would you have put in a script to be triggered by
4 udev when a USB or Firewire backup drive has been unplugged?
5
6 The external Firewire drive I used for nightly backups died yesterday.
7
8 I replaced it with a USB3 drive, so I needed to update the udev rules
9 that automatically mount it and then "umount" it when it's removed.
10 Both rules are firing when they should:
11
12 KERNEL=="sd?1",\
13 SUBSYSTEMS=="scsi",\
14 ENV{ID_SERIAL}=="WD_My_Passport_259F_57584A314143353435594B54-0:0",\
15 ACTION=="add",\
16 SYMLINK+="passport",\
17 RUN+="/bin/mount -text4 -o atime /dev/%k /extbackup"
18
19 KERNEL=="sd?1",\
20 ACTION=="remove",\
21 ENV{ID_SERIAL}=="WD_My_Passport_259F_57584A314143353435594B54-0:0",\
22 RUN+="/usr/local/bin/myumount /extbackup"
23
24 Here's the embarassing part: The /usr/local/bin/myumount script went
25 missing (backup drive is dead), and I can't recall exactly what it
26 did. Obviously, one should never unplug the drive while it's mounted,
27 but if that _does_ happen, what would one put in myumount to mitigate
28 the situation.
29
30 The only think I can think of is to do a "umount -l".
31
32 --
33 Grant Edwards grant.b.edwards Yow! How many retured
34 at bricklayers from FLORIDA
35 gmail.com are out purchasing PENCIL
36 SHARPENERS right NOW??

Replies

Subject Author
Re: [gentoo-user] OT: cleanup after USB backup drive unplugged? Adam Carter <adamcarter3@×××××.com>