linux raid_如何在Linux上清理RAID签名

linux raid

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.

诸如MegaRAID之类的 RAID 系统会在磁盘上添加签名,以维护有关这些问题的信息。 当我们简单地删除这些磁盘并将它们安装到另一台服务器上时,新服务器上的Linux可能会检测到这些RAID签名信息,并拒绝继续写入磁盘。 这是一个示例 ,其中mkfs报告“系统显然正在使用”,并拒绝创建文件系统。 出于数据安全的考虑,这样做是合理的,以防有人意外移动了包含有用数据的磁盘。

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.

但是,当我们确定不再使用这些磁盘并且我们可以安全清理它们时,我们将需要清理这些签名。 现实情况是,清理元数据并不是那么简单。 在本文中,我将讨论常见问题以及如何解决这些问题以清除RAID元数据信息。 这些说明基于Fedora系统。 对于其他系统,您很可能只需要更改安装软件包的方法。

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.

此处使用的工具是dmraiddmsetupdd 。 安装所需的软件包。

# yum install mdadm dmraid

显示RAID设备 (Show RAID devices )

Show the RAID devices by

通过以下方式显示RAID设备

# 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*

删除RAID设备 (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.

在这里,有很多方法。 我展示了最容易的一个到最困难的一个。 此处的示例显示,除最后一个dd方法外,所有其他方法均失败。

使用dmsetup (Use dmsetup )

Trying directly by dmsetup may fail like:

直接通过dmsetup尝试可能会失败,例如:

# 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:

我们可以尝试使用dmraid工具。 假设磁盘为/dev/sdb

DEVICE=/dev/sdb

Remove RAID status by dmraid:

通过dmraid删除RAID状态:

# 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:

# 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

通过以下方式再次检查RAID设备

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.

现在,磁盘上的RAID签名已成功清除。 您现在可以作为新磁盘在磁盘上进行常规操作。

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/

参考文献:
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/

翻译自: https://www.systutorials.com/how-to-clean-raid-signatures-on-linux/

linux raid

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值