我今天安装了一个新磁盘并正在准备它,然后才意识到我已经在现有 RAID1 阵列上完成了“准备”工作!如果可能的话,我希望能够康复。
我的数组创建为/dev/md2来自驱动器/dev/sdf和/dev/sdh。这是我看到的fdisk -l
前破坏任何东西:
Disk /dev/sdf: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK01
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdf1 1 4294967295 4294967295 2T ee GPT
Partition 1 does not start on physical sector boundary.
...
Disk /dev/sdh: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK03
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdh1 1 4294967295 4294967295 2T ee GPT
Partition 1 does not start on physical sector boundary.
...
Disk /dev/md2: 10.91 TiB, 12000003358720 bytes, 23437506560 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
然后我跑了fdisk /dev/md2
然后输入g
然后w
:
Command (m for help): g
Created a new GPT disklabel (GUID: C3FA8F3E-4DD4-AD47-B2D4-F838EF831A2E).
The device contains 'ext4' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.
Command (m for help): w
The partition table has been altered.
Syncing disks.
fdisk -l
现在显示:
Disk /dev/sdf: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK01
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdf1 1 4294967295 4294967295 2T ee GPT
Partition 1 does not start on physical sector boundary.
...
Disk /dev/sdh: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK03
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdh1 1 4294967295 4294967295 2T ee GPT
Partition 1 does not start on physical sector boundary.
...
Disk /dev/md2: 10.91 TiB, 12000003358720 bytes, 23437506560 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
Disklabel type: gpt
Disk identifier: C3FA8F3E-4DD4-AD47-B2D4-F838EF831A2E
然后我fdisk /dev/md2
再次运行,然后n
使用所有默认值运行:
Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-23437506526, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-23437506526, default 23437506526):
Created a new partition 1 of type 'Linux filesystem' and of size 10.9 TiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
然后我又跑了fdisk -l
一遍,才意识到我的愚蠢错误:
Disk /dev/sdf: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK01
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdf1 1 4294967295 4294967295 2T ee GPT
Partition 1 does not start on physical sector boundary.
...
Disk /dev/sdh: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK03
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdh1 1 4294967295 4294967295 2T ee GPT
Partition 1 does not start on physical sector boundary.
...
Disk /dev/md2: 10.91 TiB, 12000003358720 bytes, 23437506560 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
Disklabel type: gpt
Disk identifier: C3FA8F3E-4DD4-AD47-B2D4-F838EF831A2E
Device Start End Sectors Size Type
/dev/md2p1 2048 23437506526 23437504479 10.9T Linux filesystem
这是当前的状态/proc/mdstat
:
md2 : active raid1 sdh[1] sdf[0]
11718753280 blocks super 1.2 [2/2] [UU]
bitmap: 0/88 pages [0KB], 65536KB chunk
md1 : active raid1 sda[0] sdb[1]
15625747456 blocks super 1.2 [2/2] [UU]
bitmap: 0/117 pages [0KB], 65536KB chunk
md0 : active raid1 sdc[0] sdd[1]
15625747456 blocks super 1.2 [2/2] [UU]
bitmap: 0/117 pages [0KB], 65536KB chunk
我现在已经卸载了 /dev/md2 并注释掉了/etc/mdadm/mdadm.conf
.
奇怪的是,在卸载之前,我在检查磁盘使用情况时看到了这一点:
plexadmin@petaccio-plex:/mnt$ df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/md2 4.4T 3.8T 0 100% /mnt/md2
...
虽然我不确定如何解释这一点,因为这些是 RAID1 阵列中的 12TB 磁盘。
我最初使用创建数组这个 DigitalOcean 教程,最终创建了一个文件系统:
mkfs.ext4 -F /dev/md2
我不知道从这里到哪里去,并且对做一些(其他)愚蠢的事情和破坏数据感到紧张。
这个阵还有恢复的希望吗?
感谢大家的帮助和时间! :)
答案1
我能够使用找到的说明恢复 ext4 文件系统这里:
我曾经fsck.ext4 -vy /dev/md2
检查和修复 ext4 文件系统。经过一些自动更正错误后,我能够安装阵列,我发现所有数据都完好无损!
快速提醒在获取数据之前仔细检查你的工作! :D