我透過強制重新啟動(在第五個硬碟上)意外損壞了 Ubuntu 17.10 的版本。在我的系統中,我還有 4 個其他硬碟驅動器,屬於 RAID5 陣列。現在我已經再次安裝了 Ubuntu 17.10,如何恢復我的陣列和資料?
我都嘗試過
sudo mdadm --assemble --uuid=XXXXXXXXXX
和
sudo mdadm --assemble /dev/md0 /dev/sdb /dev/sdc /dev/sdd /dev/sde
然後我可以安裝它,但是當我訪問文件時,它會提示輸入密碼並且資料夾是空的。所有陣列成員都顯示出活躍且乾淨的狀態。
注意:在崩潰之前,我將 /home 目錄移動並安裝到了該 RAID 上。請參閱下面的輸出:
cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10]
md0 : active raid5 sde[4] sdb[0] sdd[2] sdc[1] 8790405120 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]
bitmap: 0/22 pages [0KB], 65536KB chunk
unused devices: <none>
下面的輸出為
sudo parted --list /dev/md0
Model: ATA TS128GSSD370S (scsi)
Disk /dev/sda: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp
2 538MB 128GB 127GB ext4
Error: end of file while reading /dev/sdb
Retry/Ignore/Cancel? retry
Error: end of file while reading /dev/sdb
Retry/Ignore/Cancel? ignore
Error: The primary GPT table is corrupt, but the backup appears OK, so that will
be used.
OK/Cancel? ok
Model: ATA ST3000VN000-1HJ1 (scsi)
Disk /dev/sdb: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
Error: /dev/sdc: unrecognised disk label
Model: ATA ST3000VN000-1HJ1 (scsi)
Disk /dev/sdc: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags:
Error: /dev/sdd: unrecognised disk label
Model: ATA ST3000VN000-1HJ1 (scsi)
Disk /dev/sdd: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags:
Error: end of file while reading /dev/sde
Retry/Ignore/Cancel? ignore
Error: The primary GPT table is corrupt, but the backup appears OK, so that will
be used.
OK/Cancel? ok
Model: ATA ST3000VN000-1HJ1 (scsi)
Disk /dev/sde: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
Model: WD Elements 25A1 (scsi)
Disk /dev/sdf: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 3001GB 3001GB ntfs Elements msftdata
Model: Linux Software RAID Array (md)
Disk /dev/md0: 9001GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 9001GB 9001GB ext4
掛載 /dev/md0 /mnt 後
ls -la /dev/md* 的輸出是
brw-rw---- 1 root disk 9, 0 Apr 13 16:31 /dev/md0
/dev/md:
total 0
drwxr-xr-x 2 root root 60 Apr 13 16:31 .
drwxr-xr-x 21 root root 4520 Apr 13 16:31 ..
lrwxrwxrwx 1 root root 6 Apr 13 16:31 0 -> ../md0
答案1
這不是raid問題,更多的是權限問題。如果檢查命令的輸出cat /proc/mdstat
,您可以看到 raid5 已完美組裝,如行[UUUU]
中所示md0
。
Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10]
md0 : active raid5 sde[4] sdb[0] sdd[2] sdc[1] 8790405120 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]
bitmap: 0/22 pages [0KB], 65536KB chunk
unused devices: <none>
分區表(循環設備的循環)和檔案系統(ext4)也很好。安裝循環設備後,mount /dev/md0 /mnt
您應該會看到類似以下內容:
$ mount /dev/md0 /mnt
$ ls -la /mnt
total 12
drwxr-xr-x 3 root root 4096 Jun 29 2016 .
drwxr-xr-x 10 root root 4096 Dec 7 10:42 ..
drwxr-xr-x 3 1001 2001 4096 Feb 6 2017 oldusername
現在您需要將舊用戶主頁的所有者更改為當前用戶:
$ sudo chown $(stat -c '%u:%g' ~/) /mnt/oldusername
$ ls -la /mnt
total 12
drwxr-xr-x 3 root root 4096 Jun 29 2016 .
drwxr-xr-x 10 root root 4096 Dec 7 10:42 ..
drwxr-xr-x 3 currentuser currentgroup 4096 Feb 6 2017 oldusername