在不丢失数据的情况下删除 mdadm raid1

ped*_*dja 3 raid mdadm

我有 2 个hdd'sraid1使用mdadm.

现在我想完全禁用突袭,但我想将数据保留在磁盘 1 上,并单独使用磁盘 2

有没有办法做到这一点。

老实说,我知道raid是什么,但我不知道它是如何处理的mdadm

我正在使用 Ubuntu 14.04

配置:

mdadm: /dev/md does not appear to be an md device
/dev/md0:
        Version : 1.2
  Creation Time : Tue Jul  7 10:13:17 2015
     Raid Level : raid1
     Array Size : 16768896 (15.99 GiB 17.17 GB)
  Used Dev Size : 16768896 (15.99 GiB 17.17 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Sun Oct 11 15:50:16 2015
          State : clean 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           Name : rescue:0
           UUID : ec52104c:85983ebd:8a13b660:706bae89
         Events : 32

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
/dev/md1:
        Version : 1.2
  Creation Time : Tue Jul  7 10:13:20 2015
     Raid Level : raid1
     Array Size : 523968 (511.77 MiB 536.54 MB)
  Used Dev Size : 523968 (511.77 MiB 536.54 MB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Sat Sep 19 12:41:03 2015
          State : clean 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           Name : rescue:1
           UUID : decb590d:aac47b81:568a2afa:3dee7600
         Events : 30

    Number   Major   Minor   RaidDevice State
       0       8        2        0      active sync   /dev/sda2
       1       8       18        1      active sync   /dev/sdb2
/dev/md2:
        Version : 1.2
  Creation Time : Tue Jul  7 10:13:20 2015
     Raid Level : raid1
     Array Size : 1073610560 (1023.87 GiB 1099.38 GB)
  Used Dev Size : 1073610560 (1023.87 GiB 1099.38 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Mon Oct 12 09:25:14 2015
          State : clean 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           Name : rescue:2
           UUID : 1daa4480:ddf3f359:575a1f97:e232bbdd
         Events : 195

    Number   Major   Minor   RaidDevice State
       0       8        3        0      active sync   /dev/sda3
       1       8       19        1      active sync   /dev/sdb3
/dev/md3:
        Version : 1.2
  Creation Time : Tue Jul  7 10:13:20 2015
     Raid Level : raid1
     Array Size : 1839089920 (1753.89 GiB 1883.23 GB)
  Used Dev Size : 1839089920 (1753.89 GiB 1883.23 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Mon Oct 12 09:04:16 2015
          State : clean 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           Name : rescue:3
           UUID : 051aac4e:ecac8794:538fe663:c9212747
         Events : 92

    Number   Major   Minor   RaidDevice State
       0       8        4        0      active sync   /dev/sda4
       1       8       20        1      active sync   /dev/sdb4  
Run Code Online (Sandbox Code Playgroud)

.

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 3000.6 GB, 3000592982016 bytes
256 heads, 63 sectors/track, 363376 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1  4294967295  2147483647+  ee  GPT

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
256 heads, 63 sectors/track, 363376 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/md0: 17.2 GB, 17171349504 bytes
2 heads, 4 sectors/track, 4192224 cylinders, total 33537792 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md1: 536 MB, 536543232 bytes
2 heads, 4 sectors/track, 130992 cylinders, total 1047936 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/md3: 1883.2 GB, 1883228078080 bytes
2 heads, 4 sectors/track, 459772480 cylinders, total 3678179840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md3 doesn't contain a valid partition table

Disk /dev/md2: 1099.4 GB, 1099377213440 bytes
2 heads, 4 sectors/track, 268402640 cylinders, total 2147221120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md2 doesn't contain a valid partition table
Run Code Online (Sandbox Code Playgroud)

小智 6

您不能直接从阵列中删除磁盘,除非它发生故障,因此我们首先必须使其失效(如果驱动器发生故障,这通常已经处于故障状态,不需要此步骤):

mdadm --fail /dev/md0 /dev/sda1
Run Code Online (Sandbox Code Playgroud)

现在我们可以删除它:

mdadm --remove /dev/md0 /dev/sda1
Run Code Online (Sandbox Code Playgroud)

这可以使用以下方法一步完成:

mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sda1
Run Code Online (Sandbox Code Playgroud)

然后将磁盘挂载为普通磁盘:

sudo mount -t auto /dev/sda1 /media/disk
Run Code Online (Sandbox Code Playgroud)