| |

How to Clean RAID Signatures on Linux

RAID systems such as MegaRAID add signatures to disks to maintain the infomration on these didks. When we simply remove these disks and install them to another server, Linux on the new server may detect these RAID signature infomration and refuses to continue write to the disk. Here is one example that mkfs reports “apparently in use by the system” and refuses making a filesystem. It is reasonable to do so for the sake of data safety in case someone accidentally moved a disk with useful data.

However, we will need to clean these signatures when we are sure that these disks are not used anymore and we are safe to clean it. The reality is that cleaning the metadata is not that staightforward. In this post, I will discuss common problems and how to fix them to clean the RAID metadata information. The instructions are based on Fedora systems. For other systems, you most likely only need to change the method installing the packages.

Note that the instructions here are dangerous and possibly erase all your data on a disk. Follow these instructions only if you know what you are doing.

Needed tools

The tools used here are dmraid, dmsetup and dd. Install needed packages.

# yum install mdadm dmraid

Show RAID devices

Show the RAID devices by

# dmraid -r

It will show the results like

/dev/sdb: ddf1, ".ddf1_disks", GROUP, ok, 3904294912 sectors, data@ 0

You may find the device at:

# ls /dev/mapper/ddf*

Remove RAID device

Here, there are many methods. I show the most easier one to the most hard one. The example here shows that all except the last dd method failed.

Use dmsetup

Trying directly by dmsetup may fail like:

# dmsetup remove /dev/mapper/ddfs1_...

The result:

device-mapper: remove ioctl on ddf1_49424d202020202010000073101403b141c2c9e96c8236dbp1 failed: Device or resource busy
Command failed

We may try the dmraid tool. Assume the disk is /dev/sdb:

DEVICE=/dev/sdb

Remove RAID status by dmraid:

# dmraid -r -E $DEVICE

In this example, it still failed showing errors as follows.

Do you really want to erase "ddf1" ondisk metadata on /dev/sdb ? [y/n] :y

ERROR: ddf1: seeking device "/dev/sdb" to 1024204253954048
ERROR: writing metadata to /dev/sdb, offset 2000398933504 sectors, size 0 bytes returned 0
ERROR: erasing ondisk metadata on /dev/sdb

If all failed, you may try the powerful dd:

# dd if=/dev/zero of=$DEVICE bs=512 seek=$(( $(blockdev --getsz $DEVICE) - 1024 )) count=1024
1024+0 records in
1024+0 records out
524288 bytes (524 kB) copied, 0.00216637 s, 242 MB/s

Check the RAID devices again by

dmraid -r

Now it shows:

no raid disks

Now the RAID signature on the disk is successfully cleaned. You can do normal operations on the disk as a new disk now.

References:
http://www.server-world.info/en/note?os=CentOS_6&p=raid_metadata
https://kezhong.wordpress.com/2011/06/14/how-to-remove-bios-raid-metadata-from-disk-on-fedora/
http://serverfault.com/questions/488346/removing-raid-metadata-from-drives
http://djlab.com/2013/07/removing-raid-metadata/

Similar Posts

  • Latex is stuck with a strange problem, see more information for details.

    $ make pdflatex main.tex This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex) restricted write18 enabled. entering extended mode (./main.tex LaTeX2e <2016/02/01> Babel <3.9q> and hyphenation patterns for 81 language(s) loaded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./usenix.sty (/usr/share/texlive/texmf-dist/tex/latex/psnfss/mathptmx.sty)) (/usr/share/texlive/texmf-dist/tex/latex/graphics/epsfig.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty) (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg) (/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)…

  • Multisig 101

    Multisig, short for “multisignature,” is a cryptographic mechanism that requires multiple signatures to authorize and execute a transaction. What is Multisig Multisig ensures that multiple parties must collaborate and approve a transaction before it can be deemed valid. It provides an additional layer of security requiring multiple parties’ signatures to spend or transfer the crypto…

  • Configuring Gnome Desktop with Gconf-editor

    gconf-editor gnome桌面配置工具 最近换了一个漂亮的图标集,以前嫌桌面上我的电脑等图标没有用处就关闭了,现在换了好看的图标想再把它们拿出来。 找到了gconf-editor这个工具,还是很不错的,配置起来挺方便的。 # yum install gconf-editor 在apps->nautilus->desktop 设置下 computer_icon_visible home_icon_visible trash_icon_visible 三个值就可以了。 Read more: Configuring Mouse Cursor Style for QT Applications in GNOME / MATE Desktop Configuring Mouse Cursor Style for GTK Applications in KDE Desktop Configuring Eclipse to Show Git Revision Information Similar to Git Blame in Editor Beautiful Desktop – Gnome…

  • Why I cannot login remote server with its root

    # ssh root@192.168.122.96 root@192.168.122.96’s password: Permission denied, please try again. Do according to [1]. NOTE: on Ubuntu, remember to restart ssh service like this “sudo restart ssh”. [1] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/v2v_guide/preparation_before_the_p2v_migration-enable_root_login_over_ssh Read more: I cannot login Ubuntu Precise desktop ‘dd’ command cannot support calculation for its parameters How can I login without password and run command in…

  • How to detach a docker container to be a running daemon?

    If I quite a docker instanced (invoking /bin/bash) by Ctrl+d, the docker container is closed. How to detach a docker container to be a running daemon without closing it? Docker has a detach sequence, which, by default, is Ctrl-p + Ctrl-q. If the docker detach sequence is overridden by the –detach-keys=”<sequence>” flag, you need to…

6 Comments

    1. The one to erase the metadata needs to have the “root” or “sudo” access. In Linux, if the “root” access is leaked, lots malicious things could be done.

Leave a Reply

Your email address will not be published. Required fields are marked *