LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Unable to remove partition from device-mapper (https://www.linuxquestions.org/questions/linux-server-73/unable-to-remove-partition-from-device-mapper-4175507720/)

pingu 06-11-2014 08:47 AM

Unable to remove partition from device-mapper
 
Problem: /dev/sdb1 is always recognized as lvm/dm partition.
Cause: Myself... :mad: ("SBT" in Swedish. )

A 500GB disk with one partition on it was used for OpenSuse raid.
Now I ditched the server, removed the disk - without removing it from raid! :banghead:
This disk is now second disk in a new server, with OS on it's first disk.
But the disk and the partition /dev/sdb1 always turns up in /dev/mapper.
When I mount /dev/sdb1 it is recognized as /dev/mapper/1ATA_WDC_WD5002ABYS-18B1B0_WD-WCASYE035842p1
It seems everything works, but I am still worried about this. This partition is now type 83 ext4, and not used in any raid or lvm.
And the server is to be a production server, it's an oVirt node.

What I have done to fix the issue:
Tried to remove from dm:
Code:

dmsetup remove  /dev/mapper/1ATA_WDC_WD5002ABYS-18B1B0_WD-WCASYE035842p1
dmsetup remove  /dev/mapper/1ATA_WDC_WD5002ABYS-18B1B0_WD-WCASYE035842

This was my first try, also did this first thing before trying other things.
The /dev/mapper/ entries are removed, mounting now looks good - but it doesn't persist after reboot.

So I continued:
I used shred on the entire disk (#shred /dev/sdb)
I zeroed out the beginning and end, when that didn't change anything I also zeroed out entire disk:
Code:

dd bs=512 if=/dev/zero of=/dev/sdb count=8196 seek=$((`blockdev --getsz /dev/sdb` - 8196))
dd if=/dev/zero |pv| dd of=/dev/sdb bs=8192

Changed /dev/sdb1 to lvm in the hope it could then be removed permanently from device-mapper.
Did not work.

The system is using lvm so I can't just deinstall it:
Code:

/dev/mapper/vg_node1-lv_root          50G  12G  36G  24% /
tmpfs                                          16G    0  16G  0% /dev/shm
/dev/sda1                                    485M  55M  405M  12% /boot
/dev/mapper/vg_node1-lv_od                164G  6,2G  150G  4% /ct/od

There is no 'dm' command.

potato_farmer 06-11-2014 10:45 AM

What's the output of the following commands?

# pvs

# vgs

# lvs

pingu 06-11-2014 10:51 AM

[root@ctnode1 ~]# pvs
Code:

PV        VG      Fmt  Attr PSize  PFree
  /dev/sda2  vg_node1 lvm2 a--  232,34g    0

[root@ctnode1 ~]# vgs
Code:

  VG      #PV #LV #SN Attr  VSize  VFree
  vg_node1  1  3  0 wz--n- 232,34g    0

[root@ctnode1 ~]# lvs
Code:

LV      VG      Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync Convert
  lv_od  vg_node1 -wi-ao---- 166,60g                                           
  lv_root vg_node1 -wi-ao----  50,00g                                           
  lv_swap vg_node1 -wi-ao----  15,74g

So only vg_node1 is actually there. This is the vg holding my system partitions.

smallpond 06-11-2014 10:58 AM

lvm creates backup and archive files under /etc/lvm/. You may need to update those before rebooting. See vgcfgbackup.

pingu 06-11-2014 11:18 AM

Thanks, but that didn't help either.
I deleted (after backup-ing) /etc/lvm/archive/ /etc/lvm/backup/ /etc/lvm/cache/.cache and rebooted, no change.


All times are GMT -5. The time now is 03:50 PM.