Remove disk from /dev/mapper control

Linux specific questions/information are gathered here. The main thrust of topics are applied to Centos/RedHat(RH)/Debian/Ubuntu/Gentoo distributives

Remove disk from /dev/mapper control

Postby lik » Fri Jan 06, 2012 9:22 am

Members of dmraid arrays (block and software RAID devices) contain metadata signatures which are used to discover/assemble target RAID sets.

To remove them and release undelying block devices one should erase metadata signatures.

Discover all software RAID devices supported on your system, eg:
Code: Select all
# dmraid -r
/dev/dm-46: hpt45x, "hpt45x_chidjhaiaa-0", striped, ok, 320172928 sectors, data@ 0
/dev/dm-50: hpt45x, "hpt45x_chidjhaiaa-0", striped, ok, 320172928 sectors, data@ 0
/dev/dm-54: hpt45x, "hpt45x_chidjhaiaa-1", striped, ok, 320172928 sectors, data@ 0
/dev/dm-58: hpt45x, "hpt45x_chidjhaiaa-1", striped, ok, 320172928 sectors, data@ 0

If {-E| --erase_metadata} is added to {-r| --raid_devices} the RAID metadata on the devices gets conditionally erased:
Code: Select all
# dmraid -rE
Do you really want to erase "hpt45x" ondisk metadata on /dev/sdb ? [y/n] :y
...
...

And then remove logical devices which use device-mapper driver:
Code: Select all
# dmsetup remove /dev/mapper/hpt45x_chidjhaiaa-0
...
...
lik
Founder
Founder
 
Posts: 497
Joined: Wed Dec 15, 2010 3:21 am

Destroy RAID metadata

Postby lik » Fri Nov 15, 2013 10:39 am

As one of the possible workarounds one can use the following commands to overwrite (read ! destroy !) RAID metadata which is stored on the HDD:

Code: Select all
dd if=/dev/zero of=/dev/sda bs=512 count=8196
dd bs=512 if=/dev/zero of=/dev/sda count=8196 seek=$((`blockdev --getsz /dev/sda` - 8196))
lik
Founder
Founder
 
Posts: 497
Joined: Wed Dec 15, 2010 3:21 am


Return to Linux specific

 


  • Related topics
    Replies
    Views
    Last post