Ubuntu18.04.4 remove lvm devices in /dev/mapper without vg and lv info

hilton

New Member
Joined
Nov 12, 2020
Messages
1
Reaction score
0
Credits
17
Hello, everybody.

the question is that I use zfs to create a block device with lvm2 format by pvcreate,vgcreate and lvcreate command, Unlucky,one day the device information lost beacause the machine suddenly went out. when the machine reboot, the infomation of devices lost with unknown reason. the vgdisplay and lvdisplay don't have the information about this devices. the more information you can find out in this link, I took the question in ask ubuntu website.

ask ubuntu question

I find the devices backup file, and then I use the command to restore,but it doesn't matter.

Code:
devops@dn008:~$ sudo vgcfgrestore vg_a0fbb2c067364fc4d49dd33a5782c823
  Failed to get thin-pool major:minor for thin device 253:4.
  Failed to get thin-pool major:minor for thin device 253:9.
  Failed to get thin-pool major:minor for thin device 253:4.
  Failed to get thin-pool major:minor for thin device 253:9.
  Couldn't find device with uuid A6qRo3-fHU7-40Vy-mOHu-my2j-y0f3-8SkUUv.
  Consider using option --force to restore Volume Group vg_a0fbb2c067364fc4d49dd33a5782c823 with thin volumes.
  Restore failed.
  Failed to get thin-pool major:minor for thin device 253:4.
  Failed to get thin-pool major:minor for thin device 253:9.

and then I want to use command "dmsetup remove" to delete, like this
Code:
 root@dn008:/home/devops# sudo ls -l /dev/mapper/ 
total 0 
crw------- 1 root root 10, 236 Oct  6 08:48 control 
lrwxrwxrwx 1 root root       7 Oct  6 13:53 vg_a0fbb2c067364fc4d49dd33a5782c823-brick_2664622db7e4ac61df1ccf5a19d99032 -> ../dm-9 
lrwxrwxrwx 1 root root       7 Oct  6 13:53 vg_a0fbb2c067364fc4d49dd33a5782c823-brick_467a0447a34476f2af26ea6edc45c153 -> ../dm-4 
lrwxrwxrwx 1 root root       7 Nov 11 09:55 vg_a0fbb2c067364fc4d49dd33a5782c823-tp_2664622db7e4ac61df1ccf5a19d99032-tpool -> ../dm-7
 lrwxrwxrwx 1 root root       7 Oct  7 01:58 vg_a0fbb2c067364fc4d49dd33a5782c823-tp_2664622db7e4ac61df1ccf5a19d99032_tdata -> ../dm-6 
lrwxrwxrwx 1 root root       7 Nov 11 09:57 vg_a0fbb2c067364fc4d49dd33a5782c823-tp_467a0447a34476f2af26ea6edc45c153-tpool -> ../dm-2
 lrwxrwxrwx 1 root root       7 Oct  7 01:58 vg_a0fbb2c067364fc4d49dd33a5782c823-tp_467a0447a34476f2af26ea6edc45c153_tdata -> ../dm-1 

root@dn008:/home/devops# dmsetup remove -v -f   /dev/dm-1
root@dn008:/home/devops# dmsetup remove -v -f   /dev/dm-6
..

root@dn008:/home/devops# lsof  /dev/dm-2
root@dn008:/home/devops# lsof  /dev/dm-7
root@dn008:/home/devops# dmsetup  remove /dev/dm-2
device-mapper: remove ioctl on vg_a0fbb2c067364fc4d49dd33a5782c823-tp_467a0447a34476f2af26ea6edc45c153-tpool  failed: Device or resource busy Command failed
root@dn008:/home/devops# dmsetup  remove /dev/dm-7
device-mapper: remove ioctl on vg_a0fbb2c067364fc4d49dd33a5782c823-tp_2664622db7e4ac61df1ccf5a19d99032-tpool  failed: Device or resource busy Command failed


root@dn008:/home/devops# ls -l /dev/mapper/
total 0
crw------- 1 root root 10, 236 Oct  6 08:48 control
lrwxrwxrwx 1 root root       7 Oct  6 13:53 vg_a0fbb2c067364fc4d49dd33a5782c823-brick_2664622db7e4ac61df1ccf5a19d99032 -> ../dm-9
lrwxrwxrwx 1 root root       7 Oct  6 13:53 vg_a0fbb2c067364fc4d49dd33a5782c823-brick_467a0447a34476f2af26ea6edc45c153 -> ../dm-4
lrwxrwxrwx 1 root root       7 Nov 12 03:15 vg_a0fbb2c067364fc4d49dd33a5782c823-tp_2664622db7e4ac61df1ccf5a19d99032-tpool -> ../dm-7
lrwxrwxrwx 1 root root       7 Nov 12 03:15 vg_a0fbb2c067364fc4d49dd33a5782c823-tp_467a0447a34476f2af26ea6edc45c153-tpool -> ../dm-2

root@dn008:/home/devops# dmsetup ls --tree
vg_a0fbb2c067364fc4d49dd33a5782c823-brick_467a0447a34476f2af26ea6edc45c153 (253:4)
 └─vg_a0fbb2c067364fc4d49dd33a5782c823-tp_467a0447a34476f2af26ea6edc45c153-tpool (253:2)
vg_a0fbb2c067364fc4d49dd33a5782c823-brick_2664622db7e4ac61df1ccf5a19d99032 (253:9)
 └─vg_a0fbb2c067364fc4d49dd33a5782c823-tp_2664622db7e4ac61df1ccf5a19d99032-tpool (253:7)


root@dn008:/home/devops# ps -ef |grep dm-4
root      7481     1  0 Nov09 ?        00:00:00 fdisk -l /dev/dm-4
root     35337     1  0 Oct25 ?        00:00:00 fdisk -l /dev/dm-4
root     56479     1  0 Nov09 ?        00:00:00 blktrace -d /dev/dm-4 -o dm-4.txt
root     62299  7978  0 07:42 pts/7    00:00:00 grep --color=auto dm-4

I don't know how to delete that , and the /dev/dm-4,/dev/dm-9 block devices, which can't not use fdisk -l command to show the information. thanks.
 


@hilton , G'day and welcome to linux.org :)

I don't usually encourage people to have the same question listed at more than one site, but I have allowed this one.

If you get a good answer at Ubuntu, please

1. Let us know, and
2. Share the answer with us.

Thanks and good luck

Chris Turner
wizardfromoz
 


Top