插入 USB 连接的 SATA SSD 后,fsck
告诉我该设备正在使用中。但它根本没有安装。这里发生了什么事?我怎样才能使用fsck
这个设备?
以下是插入设备后的一些信息:
$ dmesg
[725329.424635] usb 2-1: new SuperSpeed USB device number 6 using xhci_hcd
[725329.446411] usb 2-1: New USB device found, idVendor=152d, idProduct=1561
[725329.446420] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[725329.446426] usb 2-1: Product: SABRENT
[725329.446431] usb 2-1: Manufacturer: SABRENT
[725329.446435] usb 2-1: SerialNumber: DB9876543214E
[725329.452809] scsi host3: uas
[725329.453928] scsi 3:0:0:0: Direct-Access SABRENT 0204 PQ: 0 ANSI: 6
[725329.455721] sd 3:0:0:0: Attached scsi generic sg1 type 0
[725329.967206] sd 3:0:0:0: [sdc] 976773168 512-byte logical blocks: (500 GB/466 GiB)
[725329.967215] sd 3:0:0:0: [sdc] 4096-byte physical blocks
[725329.967362] sd 3:0:0:0: [sdc] Write Protect is off
[725329.967368] sd 3:0:0:0: [sdc] Mode Sense: 53 00 00 08
[725329.967733] sd 3:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[725329.968079] sd 3:0:0:0: [sdc] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[725330.238773] sdc: sdc1
[725330.240931] sd 3:0:0:0: [sdc] Attached SCSI disk
[725330.440904] EXT4-fs (sdc1): recovery complete
[725330.440907] EXT4-fs (sdc1): mounted filesystem with writeback data mode. Opts: (null)
$ lsblk -fs /dev/sdc1
NAME FSTYPE LABEL UUID MOUNTPOINT
sdc1 ext4 921e806c-1ccc-4427-9b4d-5e474832395a
└─sdc
$ fsck.ext4 /dev/sdc1
e2fsck 1.44.1 (24-Mar-2018)
/dev/sdc1 is in use.
e2fsck: Cannot continue, aborting.
更新:
$ lsof /dev/ | grep sdc
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
答案1
就我而言, mount 命令没有显示该设备,但有一个 docker 容器正在运行,并将目标目录绑定为卷。
如果你运行 docker,那么值得尝试一下
docker ps -q | xargs -I {} docker container inspect -f '{{ printf "{}" }}{{ .Name }} {{printf "\n"}}{{ .HostConfig.Binds }}' {}
找到挂载的目录并尝试停止该容器
答案2
您是否尝试过编辑 fstab.txt?
中列出的分区etc/fstab
可以配置为在引导过程中自动安装。
fstab 条目的语法应如下所示:
<file system> <dir> <type> <options> <dump> <pass>
/dev/sdc1 /etc/test ext4 defaults 1 2
请务必注销/重新启动。希望这可以帮助。