mdadm: cannot open /dev/sda1: Device or resource busy

建立软raid时发现资源占用,而这个分区并没有Mount

[root@qht122 dev]# mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sda1 missing
 mdadm: cannot open /dev/sda1: Device or resource busy

检查一下是否与DM有关

[root@qht122 ~]# dmsetup info
Name:              ddf1_Drive 2
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        0
Event number:      0
Major, minor:      253, 0
Number of targets: 1
UUID: DMRAID-ddf1_Drive 2
 

[root@qht122 ~]# dmsetup ls --tree
ddf1_Drive 2 (253:0)
 └─ (8:0)

[root@qht122 dev]# dmsetup ls
ddf1_Drive 2    (253:0)

在/dev下确定一下253:0和8:0所映射的设备

果然是sda被占用了,需要将此dm删除掉

[root@qht122 dev]# ls -l /dev

brw-rw----.  1 root disk    253,   0 May 31 08:35 dm-0
brw-rw----.  1 root disk      8,   0 May 31 08:35 sda

将此dm删除,发现找不到

[root@qht122 dev]# dmsetup remove ddf1_Drive 2
device-mapper: remove ioctl on ddf1_Drive  failed: No such device or address
Command failed
 

名字有空格,所以加一个双引号就可以了

[root@qht122 dev]# dmsetup remove "ddf1_Drive 2"
[root@qht122 dev]#  dmsetup ls
No devices found
 

dm删除以后就正常了!

你可能感兴趣的:(LINUX,p2p,linq,网络协议)