I am on f38, but I had this problem before with f36.
I attach an external USB disk that has CentOS.
I see that beyond the basic device and partitions, three other devices /dev/dm-{0,1,2}
show up.
Without doing anything else I want to remove the disk safely. I could not do it, see
below.
The question at the end is: how do I cleanly remove the external USB disk. It is an SSD in
a USB3.0 caddy.
Messages in the log:
Jun 4 08:49:41 e7 kernel: usb 2-8: new SuperSpeed USB device number 6 using xhci_hcd
Jun 4 08:49:41 e7 kernel: usb 2-8: New USB device found, idVendor=152d, idProduct=0578,
bcdDevice= 2.04
Jun 4 08:49:41 e7 kernel: usb 2-8: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
Jun 4 08:49:41 e7 kernel: usb 2-8: Product: External USB 3.0
Jun 4 08:49:41 e7 kernel: usb 2-8: Manufacturer: JMicron
Jun 4 08:49:41 e7 kernel: usb 2-8: SerialNumber: 201703310007F
Jun 4 08:49:41 e7 mtp-probe[2522907]: checking bus 2, device 6:
"/sys/devices/pci0000:00/0000:00:14.0/usb2/2-8"
Jun 4 08:49:41 e7 mtp-probe[2522907]: bus: 2, device: 6 was not an MTP device
Jun 4 08:49:41 e7 journal[2522912]: Couldn't connect to accessibility bus: Failed to
connect to socket /root/.cache/at-spi/bus_0: Permission denied
Jun 4 08:49:41 e7 kernel: usbcore: registered new interface driver usb-storage
Jun 4 08:49:41 e7 Thunar[2522912]: thunar-volman: Unsupported USB device type
"usb".
Jun 4 08:49:41 e7 kernel: scsi host7: uas
Jun 4 08:49:41 e7 kernel: usbcore: registered new interface driver uas
Jun 4 08:49:41 e7 kernel: scsi 7:0:0:0: Direct-Access External USB3.0 0204
PQ: 0 ANSI: 6
Jun 4 08:49:41 e7 kernel: sd 7:0:0:0: Attached scsi generic sg9 type 0
Jun 4 08:49:41 e7 kernel: sd 7:0:0:0: [sdi] 468877312 512-byte logical blocks: (240
GB/224 GiB)
Jun 4 08:49:41 e7 kernel: sd 7:0:0:0: [sdi] 4096-byte physical blocks
Jun 4 08:49:41 e7 kernel: sd 7:0:0:0: [sdi] Write Protect is off
Jun 4 08:49:41 e7 kernel: sd 7:0:0:0: [sdi] Disabling FUA
Jun 4 08:49:41 e7 kernel: sd 7:0:0:0: [sdi] Write cache: enabled, read cache: enabled,
doesn't support DPO or FUA
Jun 4 08:49:41 e7 kernel: sd 7:0:0:0: [sdi] Preferred minimum I/O size 4096 bytes
Jun 4 08:49:41 e7 kernel: sd 7:0:0:0: [sdi] Optimal transfer size 33553920 bytes not a
multiple of preferred minimum block size (4096 bytes)
Jun 4 08:49:41 e7 kernel: sdi: sdi1 sdi2
Jun 4 08:49:41 e7 kernel: sd 7:0:0:0: [sdi] Attached SCSI disk
Jun 4 08:49:41 e7 mtp-probe[2522930]: checking bus 2, device 6:
"/sys/devices/pci0000:00/0000:00:14.0/usb2/2-8"
Jun 4 08:49:41 e7 mtp-probe[2522930]: bus: 2, device: 6 was not an MTP device
Jun 4 08:49:41 e7 journal[2522929]: Couldn't connect to accessibility bus: Failed to
connect to socket /root/.cache/at-spi/bus_0: Permission denied
Jun 4 08:49:41 e7 Thunar[2522929]: thunar-volman: Unsupported USB device type
"uas".
Jun 4 08:49:41 e7 journal[2522945]: Couldn't connect to accessibility bus: Failed to
connect to socket /root/.cache/at-spi/bus_0: Permission denied
Jun 4 08:49:41 e7 lvm[2522948]: PV /dev/sdi2 online, VG cl is complete.
Jun 4 08:49:41 e7 Thunar[2522945]: thunar-volman: Unknown block device type
"disk".
Jun 4 08:49:41 e7 journal[2522955]: Couldn't connect to accessibility bus: Failed to
connect to socket /root/.cache/at-spi/bus_0: Permission denied
Jun 4 08:49:41 e7 systemd[1]: Started lvm-activate-cl.service - /usr/sbin/lvm vgchange
-aay --autoactivation event cl.
Jun 4 08:49:41 e7 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295
subj=kernel msg='unit=lvm-activate-cl comm="systemd"
exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 4 08:49:41 e7 journal[2522964]: Couldn't connect to accessibility bus: Failed to
connect to socket /root/.cache/at-spi/bus_0: Permission denied
Jun 4 08:49:41 e7 kernel: audit: type=1130 audit(1685832581.400:5394): pid=1 uid=0
auid=4294967295 ses=4294967295 subj=kernel msg='unit=lvm-activate-cl
comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=?
terminal=? res=success'
Jun 4 08:49:41 e7 journal[2522982]: Couldn't connect to accessibility bus: Failed to
connect to socket /root/.cache/at-spi/bus_0: Permission denied
Jun 4 08:49:41 e7 Thunar[2522982]: thunar-volman: Unknown block device type
"disk".
Jun 4 08:49:41 e7 journal[2522988]: Couldn't connect to accessibility bus: Failed to
connect to socket /root/.cache/at-spi/bus_0: Permission denied
Jun 4 08:49:41 e7 Thunar[2522988]: thunar-volman: Unknown block device type
"disk".
Jun 4 08:49:41 e7 lvm[2522963]: 3 logical volume(s) in volume group "cl" now
active
Jun 4 08:49:41 e7 journal[2522998]: Couldn't connect to accessibility bus: Failed to
connect to socket /root/.cache/at-spi/bus_0: Permission denied
Jun 4 08:49:41 e7 Thunar[2522998]: thunar-volman: Unknown block device type
"disk".
Jun 4 08:49:41 e7 systemd[1]: lvm-activate-cl.service: Deactivated successfully.
Jun 4 08:49:41 e7 audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295
subj=kernel msg='unit=lvm-activate-cl comm="systemd"
exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 4 08:49:41 e7 kernel: audit: type=1131 audit(1685832581.500:5395): pid=1 uid=0
auid=4294967295 ses=4294967295 subj=kernel msg='unit=lvm-activate-cl
comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=?
terminal=? r
I then see
$ sudo vgs
VG #PV #LV #SN Attr VSize VFree
cl 1 3 0 wz--n- 222.57g 0
$ sudo lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home cl -wi-a----- <164.70g
root cl -wi-a----- 50.00g
swap cl -wi-a----- <7.88g
$ sudo pvs
PV VG Fmt Attr PSize PFree
/dev/sdi2 cl lvm2 a-- 222.57g 0
I try
$ sudo eject /dev/sdi
eject: cannot open /dev/sdi: Device or resource busy
$ sudo eject /dev/dm-0
eject: /dev/mapper/cl-swap: is not hot-pluggable device
Then I force a device delete
$ sudo bash -c echo x >"/sys/bus/scsi/devices/7:0:0:0/delete"
and the log shows
Jun 4 09:04:08 e7 kernel: sd 7:0:0:0: [sdi] Synchronizing SCSI cache
I finally disconnect the disk with no further messages.
From now on the devices remain, e.g.
$ cat /proc/partitions|grep dm-
253 0 8261632 dm-0
G 253 1 172695552 dm-1
253 2 52428800 dm-2
$ ls -l /dev/dm-?
brw-rw---- 1 root disk 253, 0 Jun 4 08:49 /dev/dm-0
brw-rw---- 1 root disk 253, 1 Jun 4 08:49 /dev/dm-1
brw-rw---- 1 root disk 253, 2 Jun 4 08:49 /dev/dm-2
$ ls -lR /dev/disk/ | grep -E '/dev|dm-'
/dev/disk/by-id:
lrwxrwxrwx 1 root root 10 Jun 4 08:49 dm-name-cl-home -> ../../dm-1
lrwxrwxrwx 1 root root 10 Jun 4 08:49 dm-name-cl-root -> ../../dm-2
lrwxrwxrwx 1 root root 10 Jun 4 08:49 dm-name-cl-swap -> ../../dm-0
lrwxrwxrwx 1 root root 10 Jun 4 08:49 dm-uuid-LVM-XXXXX -> ../../dm-2
lrwxrwxrwx 1 root root 10 Jun 4 08:49 dm-uuid-LVM-XXXXX -> ../../dm-0
lrwxrwxrwx 1 root root 10 Jun 4 08:49 dm-uuid-LVM-XXXXX -> ../../dm-1
/dev/disk/by-uuid:
lrwxrwxrwx 1 root root 10 Jun 4 08:49 XXXXX -> ../../dm-1
lrwxrwxrwx 1 root root 10 Jun 4 08:49 XXXXX -> ../../dm-0
lrwxrwxrwx 1 root root 10 Jun 4 08:49 XXXXX -> ../../dm-2
$ sudo /usr/local/bin/lsdrv.sh | grep dm-
|-dm-0 7.88g [253:0] Empty/Unknown
|-dm-1 164.70g [253:1] Empty/Unknown
\-dm-2 50.00g [253:2] Empty/Unknown
which logs:
Jun 4 12:38:14 e7 kernel: Buffer I/O error on dev dm-1, logical block 43173872, async
page read
Jun 4 12:38:15 e7 kernel: Buffer I/O error on dev dm-2, logical block 13107184, async
page read
Jun 4 12:38:15 e7 kernel: Buffer I/O error on dev dm-0, logical block 2065392, async page
read
$ sudo lsof | grep "dm-[0-2]"
(nothing)
$ sudo lsof | grep "cl-"
(nothing)
$ sudo lsof | grep "253,[012]"
(nothing)
This stays until a reboot. I have some cron jobs that log the state of the machine and
they raise errors in the log
from looking into these devices.
--
Eyal Lebedinsky (fedora(a)eyal.emu.id.au)