device-mapper: create ioctl on v
2021-06-10 本文已影响0人
yangqing
[root@QA mapper]# ls -ltr /dev/mapper
lrwxrwxrwx. 1 root root 8 Oct 23 09:34 newUUID-lv_root -> ../dm-17
[root@QA mapper]# dmsetup remove newUUID-lv_root
[root@QA mapper]# dmsetup remove --force /dev/mapper/vg_qa-snap2
[root@QA mapper]#
[root@QA mapper]# dmsetup remove --force /dev/mapper/vg_qa-snap2
device-mapper: remove ioctl on vg_qa-snap2 failed: Device or resource busy
Command failed
[root@QA mapper]# dmsetup info -c /dev/mapper/vg_qa-snap2
Name Maj Min Stat Open Targ Event UUID
vg_qa-snap2 253 16 L--w 1 1 0 part2-LVM-HZDfYZOYXTlZCP8n3Z8mmMACc05JJdUVjkfBxS7oshjjCk7pT6DojiR3g01XXUMf
[root@QA mapper]# dmsetup status | grep snap
vg_qa-snap2: 0 20445184 error
vg_qa-kickstart--first: 0 20971520 snapshot-origin
[root@QA mapper]# kpartx -av /dev/mapper/vg_qa-snap
add map vg_qa-snap1 (253:15): 0 524288 linear /dev/mapper/vg_qa-snap 2048
add map vg_qa-snap2 (253:16): 0 20445184 linear /dev/mapper/vg_qa-snap 526336
[root@QA mapper]# pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/vg_qa-snap2 newUUID lvm2 a-- 9.75g 0
/dev/sda2 vg_qa lvm2 a-- 232.63g 0
/dev/sdb1 vg_qa lvm2 a-- 931.51g 724.84g
[root@QA mapper]# vgchange -ay
1 logical volume(s) in volume group "newUUID" now active
13 logical volume(s) in volume group "vg_qa" now active
[root@QA mapper]# lvscan | grep UUID
ACTIVE '/dev/newUUID/lv_root' [9.75 GiB] inherit
The UUID named newUUID was trapped with an error as described in the quote above, once that was clear it was able to become active.
[root@QA mapper]# mount /dev/newUUID/lv_root /mnt
[root@QA mapper]# ls /mnt
bin boot dev etc home lib lib64 lost+found media mnt opt proc root sbin selinux srv sys tmp usr var
The logical volume was named /dev/lvols/ubuntu64
At first
$lvremove /dev/lvols/ubuntu64
This command couldn’t remove the logical volume the next command I tried was
root@manager-desktop:~# dmsetup remove --force /dev/lvols/ubuntu64
device-mapper: remove ioctl failed: Device or resource busy
Command failed
So some process is using this logical volume and to find the process id the next command was
root@manager-desktop:~# lsof /dev/lvols/ubuntu64
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
vblade 31213 root 3u BLK 252,4 0t0 115749 /dev/lvols/../mapper/lvols-ubuntu64
root@manager-desktop:~# kill -9 31213
Now issued the commands
root@manager-desktop:~# dmsetup remove --force /dev/lvols/ubuntu64
root@manager-desktop:~# lvremove /dev/lvols/ubuntu64
Logical volume "ubuntu64" successfully removed