On my server, I had an SSD as the boot drive with 11 6TB HDDs in a RAID6 setup as additional storage. However, after running into some issues with the motherboard, I switched the motherboard to one with only 4 SATA ports, so I reduced the size of the RAID6 setup from 11 to 4 drives. With <6TB of actual data being stored on the array, the data should be able to fit in the reduced storage space.
I believe I used the instructions on the following pages to shrink the array. Since it was quite a while ago, I don't actually remember if these were the pages or instructions used, nor do I remember many of the fine details:
- https://superuser.com/questions/834100/shrink-raid-by-removing-a-disk
- https://delightlylinux.wordpress.com/2020/12/22/how-to-remove-a-drive-from-a-raid-array/
On the 7 unused drives, I believe I zeroed the superblocks: sudo mdadm --zero-superblock.
For the 4 drives I want to use, I am unable to mount. I do not believe I used any partitions on the array.
sudo mount /dev/md127 /mnt/md127
mount: /mnt/md127: wrong fs type, bad option, bad superblock on /dev/md127, missing codepage or helper program, or other error.
From /var/log/syslog:
kernel: [ 1894.040670] EXT4-fs (md127): bad geometry: block count 13185878400 exceeds size of device (2930195200 blocks)
Since 13185878400 / 2930195200 = 4.5 = 9 / 2, I assume there is a problem with shrinking the file system or something similar. Since the RAID6 has 2 spare drives, going from 11 (9 active, 2 spare) to 11 (2 active, 9 spare)? to 4 (2 active, 2 spare) would explain why the block count is much higher than the size of the device by an exact multiple of 4.5.
Other information from the devices:
sudo mdadm --detail /dev/md127
/dev/md127:
Version : 1.2
Creation Time : Wed Nov 24 22:28:38 2021
Raid Level : raid6
Array Size : 11720780800 (10.92 TiB 12.00 TB)
Used Dev Size : 5860390400 (5.46 TiB 6.00 TB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Sun Apr 9 04:57:29 2023
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 512K
Consistency Policy : bitmap
Name : nao0:0 (local to host nao0)
UUID : ffff85d2:b7936b45:f19fc1ba:29c7b438
Events : 199564
Number Major Minor RaidDevice State
9 8 16 0 active sync /dev/sdb
1 8 48 1 active sync /dev/sdd
2 8 32 2 active sync /dev/sdc
10 8 0 3 active sync /dev/sda
sudo mdadm --examine /dev/sd[a-d]
/dev/sda:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
Array UUID : ffff85d2:b7936b45:f19fc1ba:29c7b438
Name : nao0:0 (local to host nao0)
Creation Time : Wed Nov 24 22:28:38 2021
Raid Level : raid6
Raid Devices : 4
Avail Dev Size : 11720780976 sectors (5.46 TiB 6.00 TB)
Array Size : 11720780800 KiB (10.92 TiB 12.00 TB)
Used Dev Size : 11720780800 sectors (5.46 TiB 6.00 TB)
Data Offset : 264192 sectors
Super Offset : 8 sectors
Unused Space : before=264112 sectors, after=176 sectors
State : clean
Device UUID : 07f76b7f:f4818c5a:3f0d761d:b2d0ba79
Internal Bitmap : 8 sectors from superblock
Update Time : Sun Apr 9 04:57:29 2023
Bad Block Log : 512 entries available at offset 32 sectors
Checksum : 914741c4 - correct
Events : 199564
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 3
Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdb:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
Array UUID : ffff85d2:b7936b45:f19fc1ba:29c7b438
Name : nao0:0 (local to host nao0)
Creation Time : Wed Nov 24 22:28:38 2021
Raid Level : raid6
Raid Devices : 4
Avail Dev Size : 11720780976 sectors (5.46 TiB 6.00 TB)
Array Size : 11720780800 KiB (10.92 TiB 12.00 TB)
Used Dev Size : 11720780800 sectors (5.46 TiB 6.00 TB)
Data Offset : 264192 sectors
Super Offset : 8 sectors
Unused Space : before=264112 sectors, after=176 sectors
State : clean
Device UUID : 3b51a0c9:b9f4f844:68d267ed:03892b0d
Internal Bitmap : 8 sectors from superblock
Update Time : Sun Apr 9 04:57:29 2023
Bad Block Log : 512 entries available at offset 32 sectors
Checksum : 294a8c37 - correct
Events : 199564
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 0
Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdc:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
Array UUID : ffff85d2:b7936b45:f19fc1ba:29c7b438
Name : nao0:0 (local to host nao0)
Creation Time : Wed Nov 24 22:28:38 2021
Raid Level : raid6
Raid Devices : 4
Avail Dev Size : 11720780976 sectors (5.46 TiB 6.00 TB)
Array Size : 11720780800 KiB (10.92 TiB 12.00 TB)
Used Dev Size : 11720780800 sectors (5.46 TiB 6.00 TB)
Data Offset : 264192 sectors
Super Offset : 8 sectors
Unused Space : before=264112 sectors, after=176 sectors
State : clean
Device UUID : 0fcca5ee:605740dc:1726070d:0cef3b39
Internal Bitmap : 8 sectors from superblock
Update Time : Sun Apr 9 04:57:29 2023
Bad Block Log : 512 entries available at offset 32 sectors
Checksum : 31472363 - correct
Events : 199564
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 2
Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdd:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x1
Array UUID : ffff85d2:b7936b45:f19fc1ba:29c7b438
Name : nao0:0 (local to host nao0)
Creation Time : Wed Nov 24 22:28:38 2021
Raid Level : raid6
Raid Devices : 4
Avail Dev Size : 11720780976 sectors (5.46 TiB 6.00 TB)
Array Size : 11720780800 KiB (10.92 TiB 12.00 TB)
Used Dev Size : 11720780800 sectors (5.46 TiB 6.00 TB)
Data Offset : 264192 sectors
Super Offset : 8 sectors
Unused Space : before=264112 sectors, after=176 sectors
State : clean
Device UUID : e1912abb:ba98a568:8effaa66:c1440bd8
Internal Bitmap : 8 sectors from superblock
Update Time : Sun Apr 9 04:57:29 2023
Bad Block Log : 512 entries available at offset 32 sectors
Checksum : 82a459ba - correct
Events : 199564
Layout : left-symmetric
Chunk Size : 512K
Device Role : Active device 1
Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
After looking online, I tried to use fsck, e2fsck, and resize2fs to try to resolve the issue. However, I did not make any progress by trying this, and I may have made the problem worse by accidentally changing the data on the disk.
With resize2fs,
sudo resize2fs /dev/md127
resize2fs 1.46.5 (30-Dec-2021)
Please run 'e2fsck -f /dev/md127' first.
Since I could not use resize2fs to actually do anything, I used e2fsck which ran into many errors. Since there were thousands of errors, I quit before the program was able to finish.
sudo e2fsck -f /dev/md127
e2fsck 1.46.5 (30-Dec-2021)
The filesystem size (according to the superblock) is 13185878400 blocks
The physical size of the device is 2930195200 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort<y>? no
Pass 1: Checking inodes, blocks, and sizes
Error reading block 3401580576 (Invalid argument) while getting next inode from scan. Ignore error<y>? yes
Force rewrite<y>? yes
Error reading block 3401580577 (Invalid argument) while getting next inode from scan. Ignore error<y>? yes
Force rewrite<y>? yes
Error reading block 3401580578 (Invalid argument) while getting next inode from scan. Ignore error<y>? yes
Force rewrite<y>? yes
Error reading block 3401580579 (Invalid argument) while getting next inode from scan. Ignore error<y>? yes
Force rewrite<y>? yes
Error reading block 3401580580 (Invalid argument) while getting next inode from scan. Ignore error<y>? yes
Force rewrite<y>? yes
Error reading block 3401580581 (Invalid argument) while getting next inode from scan. Ignore error<y>? yes
Force rewrite<y>? yes
Error reading block 3401580582 (Invalid argument) while getting next inode from scan. Ignore error<y>? yes
Force rewrite<y>?
My hypothesis is that there is probably some inconsistency in the reported size of the drives. I do not believe I had any partitions on the RAID nor any LVM volumes.
sudo fdisk -l
...
Disk /dev/sda: 5.46 TiB, 6001175126016 bytes, 11721045168 sectors
Disk model: WDC WD60EZAZ-00S
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 /dev/sdb: 5.46 TiB, 6001175126016 bytes, 11721045168 sectors
Disk model: WDC WD60EZAZ-00S
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 /dev/sdc: 5.46 TiB, 6001175126016 bytes, 11721045168 sectors
Disk model: WDC WD60EZAZ-00S
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 /dev/sdd: 5.46 TiB, 6001175126016 bytes, 11721045168 sectors
Disk model: WDC WD60EZAZ-00S
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 /dev/md127: 10.92 TiB, 12002079539200 bytes, 23441561600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
The data on the 4 currently in use may or may not be altered by fsck / e2fsck, but the data should also be on the other 7 unused drives with the zeroed superblocks. It is not important to me which drives I recover the data from, so working solutions to recover from any grouping of the drives would be highly appreciated!
If any additional information is needed, I would be more than happy to provide it.