Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] cryptsetup close and device in use when it is not
Date: Sun, 25 Jul 2021 23:10:29
Message-Id: 96fc901a-2ce4-0ea0-0ed1-1c529145c0e9@gmail.com
In Reply to: Re: [gentoo-user] cryptsetup close and device in use when it is not by Frank Steinmetzger
1 Frank Steinmetzger wrote:
2 > Am Wed, Jul 07, 2021 at 01:08:55PM -0500 schrieb Dale:
3 >
4 >> root@fireball / # blkid | grep dde669
5 >> /dev/mapper/8tb: LABEL="8tb-backup"
6 >> UUID="0277ff1b-2d7c-451c-ae94-f20f42dde669" BLOCK_SIZE="4096" TYPE="ext4"
7 >> root@fireball / # ls /dev/disk/by-uuid | grep dde669
8 >> 0277ff1b-2d7c-451c-ae94-f20f42dde669
9 >> root@fireball / #
10 > I followed this thread, and couldn’t remember ever having the same issue.
11 > But today I was bitten: It’s a 3 TB external USB drive from Intenso.
12 >
13 > Yesterday I was in the middle of a backup (it’s my main backup drive), but I
14 > had to sleep and so sent the machine into standby. I had to start the PC
15 > again a few minutes later in order to unmount an sshfs of it on another
16 > machine, and sent it right back to sleep.
17 >
18 > Just now I switched the PC back on and the drive was gone and off (USB
19 > enclosures tend to spin down the drive when USB disconnects). So I pulled
20 > the USB cable and plugged it back in for the drive to start and be
21 > rediscovered. That worked and I resumed the backup, but this enclosure has
22 > the nasty habit of sometimes intermittently disconnecting on its own.
23 >
24 > Its device was not gone (it usually disconnects for a tiny moment and then
25 > comes back, probably a USB issue), so I just tried to open it again in
26 > Dolphin, which gave me:
27 > Error unlocking /dev/sdd1: Failed to activate device: File exists
28 >
29 > $ blkid | grep luks
30 > /dev/mapper/luks-6a55a712-773e-4cd8-9776-fc9b6f39a998: LABEL="backup" UUID="50ed9519-cd9c-4d11-b78a-9f057b089362" BLOCK_SIZE="4096" TYPE="ext4"
31 >
32 > $ ls -l /dev/disk/by-uuid/6a55a*
33 > lrwxrwxrwx 10 root 2021-07-25 21:34 /dev/disk/by-uuid/6a55a712-773e-4cd8-9776-fc9b6f39a998 -> ../../sdd1
34 >
35 > $ lsblk
36 > NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
37 > […]
38 > sdd 8:48 0 2,7T 0 disk
39 > └─sdd1 8:49 0 2,7T 0 part
40 >
41 > $ mount | grep -E 'luks|sdd'
42 > [nothing]
43 >
44 > $ cryptsetup luksClose luks-6a55a712-773e-4cd8-9776-fc9b6f39a998
45 > Device luks-6a55a712-773e-4cd8-9776-fc9b6f39a998 is still in use.
46 >
47 > I don’t quite like this bad habit of the enclosure, but a 3 TB drive is a 3
48 > TB drive. I just looked at smart to see how old it is, because it has only
49 > 350 hours of power-on time, but it must be at least 5 years old. And
50 > smartctl tells me there is a firmware update available! (for Windows, Mac
51 > and—lo and behold—a bootable ISO, let’s hope it works with USB sticks).
52 >
53 > Perhaps this fixes the issue. Dale, maybe you should look for the same.
54 >
55
56
57 That's interesting.  I have two different drives, can't recall but may
58 be the same brand.  While using UUID to mount it, it would either fail
59 every time or in the case of the smaller drive, fail on occasion but not
60 every time.  The smaller drive worked most of the time but after a
61 couple failures, I switched to mounting by label.  Since switching both
62 drives to mount by labels, neither has had a single issue.  My backups
63 last time went without a hitch.  I was actually planning to post that
64 after my next backup if nothing failed.  As it is, I think switching to
65 labels has fixed it. 
66
67 I've tried external drives connected by USB before and hated them.  Slow
68 when they do work and buggy at that.  I've had more drives go bad when
69 using USB enclosures than I've ever had on IDE or (e)SATA.  I've had two
70 drives fail after years of service that were IDE or SATA.  I have three
71 drives that are bricks and all of them were in USB enclosures and far
72 young to die.  I paid more for eSATA external enclosures and have had no
73 problems with drives going dead yet.  All of them have far surpassed the
74 drives in the USB enclosures.  Heck, this 'in use' problem is the first
75 issue I recall having.  Fast too.  The SMR drive not so much but the CMR
76 drive is as fast as what is in my system connected to the mobo itself. 
77
78 The thing about this, I have no idea why switching to labels works.  The
79 UUID, label and such are nothing but links to the real device.  It
80 should make no difference at all which one is used to mount with.  I'm
81 no guru or anything but it just shouldn't matter. 
82
83 Bad thing is, I don't use anything Microsoft here.  Can a drive's
84 firmware be updated on Linux?  I think my drives are either Seagate or
85 WD.  I tend to stick with those two, unless it is a really awesome
86 deal.  I've never updated the firmware on a drive before.  I have my
87 mobo and my router but not a drive. 
88
89 Dale
90
91 :-)  :-)

Replies

Subject Author
Re: [gentoo-user] cryptsetup close and device in use when it is not Frank Steinmetzger <Warp_7@×××.de>