nas:mount_raiddisk_another
RAIDディスクを別のシステムでマウント
概要
OpenWRTのRAID-1(ミラーリング)で運用していたディスクを取り外し、1台だけ別のシステム(具体的にはRaspberry Pi)に接続してマウントする。
一般的なLinuxシステムでも同じ方法でできるはず。
手順
mdadmをインストール
sudo apt install mdadm
取り外したHDDを適当なHDDケースに入れて、RaspberryPiにUSB接続する。
そのときのdmesgの抜粋
[ 6150.566933] usb 2-2: new SuperSpeed USB device number 2 using xhci_hcd [ 6150.588314] usb 2-2: New USB device found, idVendor=152d, idProduct=0578, bcdDevice=72.05 [ 6150.588337] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 6150.588349] usb 2-2: Product: GW3.5AM-SU3P [ 6150.588359] usb 2-2: Manufacturer: Kuroutoshikou [ 6150.588368] usb 2-2: SerialNumber: 0C51800004CB [ 6150.630844] scsi host0: uas [ 6150.632117] scsi 0:0:0:0: Direct-Access ST3000DM 007-1WY10G 7205 PQ: 0 ANSI: 6 [ 6150.706932] sd 0:0:0:0: [sda] 5860533168 512-byte logical blocks: (3.00 TB/2.73 TiB) [ 6150.706952] sd 0:0:0:0: [sda] 4096-byte physical blocks [ 6150.707175] sd 0:0:0:0: [sda] Write Protect is off [ 6150.707182] sd 0:0:0:0: [sda] Mode Sense: 53 00 00 08 [ 6150.707533] sd 0:0:0:0: [sda] Disabling FUA [ 6150.707540] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 6150.741115] sd 0:0:0:0: Attached scsi generic sg0 type 0 [ 6150.763114] sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes [ 6150.763130] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of preferred minimum block size (4096 bytes) [ 6150.811705] sda: sda1 sda2 sda3 [ 6150.812083] sd 0:0:0:0: [sda] Attached SCSI disk [ 6150.922693] block device autoloading is deprecated and will be removed. [ 6150.938755] block device autoloading is deprecated and will be removed. [ 6150.971161] block device autoloading is deprecated and will be removed. [ 6150.994442] md/raid1:md125: active with 1 out of 2 mirrors [ 6151.066078] md125: detected capacity change from 0 to 5850827520 hiroshi@omvpi:~ $ hiroshi@omvpi:~ $
hiroshi@omvpi:~ $ sudo fdisk -l /dev/sda Disk /dev/sda: 2.73 TiB, 3000592982016 bytes, 5860533168 sectors Disk model: 007-1WY10G 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: 36F7B8D6-ED67-4C9C-A0A9-51CD930408B4 Device Start End Sectors Size Type /dev/sda1 64 8388671 8388608 4G Linux RAID /dev/sda2 8388672 9437247 1048576 512M Linux RAID /dev/sda3 9437248 5860529072 5851091825 2.7T Linux RAID hiroshi@omvpi:~ $
hiroshi@omvpi:~ $ ls -l /dev/md* brw-rw---- 1 root disk 9, 125 Jan 26 21:19 /dev/md125 brw-rw---- 1 root disk 9, 126 Jan 26 21:19 /dev/md126 brw-rw---- 1 root disk 9, 127 Jan 26 21:19 /dev/md127 /dev/md: total 0 lrwxrwxrwx 1 root root 8 Jan 26 21:19 OpenWrt:3 -> ../md125 hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ cat /proc/mdstat Personalities : [raid1] md125 : active (auto-read-only) raid1 sda3[0] 2925413760 blocks super 1.2 [2/1] [U_] bitmap: 3/22 pages [12KB], 65536KB chunk md126 : inactive sda2[0](S) 522240 blocks super 1.2 md127 : inactive sda1[0](S) 4189184 blocks super 1.2 unused devices: <none> hiroshi@omvpi:~ $
マウントすることで、中身にアクセスできた。
(リードオンリーのようだけど、データを救い出せることが分かったので目的は達せられた)
hiroshi@omvpi:~ $ sudo mkdir /mnt/hdd{1,2,3} hiroshi@omvpi:~ $ sudo mount /dev/md125 /mnt/hdd3 hiroshi@omvpi:~ $ ls -l /mnt/hdd3 total 32 drwxr-xr-x 3 root root 4096 May 28 2022 homes drwx------ 2 root root 16384 May 28 2022 lost+found drwxrwxrwx 8 nobody root 4096 Oct 15 2022 share -rw-r--r-- 1 root root 29 May 28 2022 TESTFILE drwxr-xr-x 6 nobody root 4096 Nov 23 2022 users hiroshi@omvpi:~ $
有効になっていないパーティションも読めるようにする。
hiroshi@omvpi:~ $ cat /proc/mdstat Personalities : [raid1] md125 : active raid1 sda3[0] 2925413760 blocks super 1.2 [2/1] [U_] bitmap: 3/22 pages [12KB], 65536KB chunk md126 : inactive sda2[0](S) 522240 blocks super 1.2 md127 : inactive sda1[0](S) 4189184 blocks super 1.2 unused devices: <none> hiroshi@omvpi:~ $
md126,md127には (S) がついている。
hiroshi@omvpi:~ $ sudo mdadm --run /dev/md126 mdadm: failed to start array /dev/md/OpenWrt:2: Invalid argument hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ sudo mdadm --run /dev/md127 mdadm: started array /dev/md/OpenWrt:1 hiroshi@omvpi:~ $
このときのdmesg
[ 6737.102710] mount: attempt to access beyond end of device md127: rw=4096, sector=2, nr_sectors = 2 limit=0 [ 6737.102743] EXT4-fs (md127): unable to read superblock [ 7090.786977] md/raid0:md126: too few disks (1 of 2) - aborting! [ 7090.787005] md: pers->run() failed ... [ 7106.421829] md/raid1:md127: active with 1 out of 2 mirrors [ 7106.421938] md127: detected capacity change from 0 to 8378368 [ 7302.314628] EXT4-fs (md127): mounted filesystem d6426954-4eed-4d17-af56-85f15dfce2b8 r/w with ordered data mode. Quota mode: none.
hiroshi@omvpi:~ $ cat /proc/mdstat Personalities : [raid1] [raid0] md125 : active raid1 sda3[0] 2925413760 blocks super 1.2 [2/1] [U_] bitmap: 3/22 pages [12KB], 65536KB chunk md126 : inactive sda2[0] 522240 blocks super 1.2 md127 : active (auto-read-only) raid1 sda1[0] 4189184 blocks super 1.2 [2/1] [U_] unused devices: <none> hiroshi@omvpi:~ $
md126 は、もともとOrenWRTにあったときから、うまく動いてなかったので無視。
md127 を -run すると、有効になった。
hiroshi@omvpi:~ $ sudo mount /dev/md127 /mnt/hdd1 hiroshi@omvpi:~ $ ls -alF /mnt/hdd1 total 32 drwxr-xr-x 5 root root 4096 May 31 2022 ./ drwxr-xr-x 5 root root 4096 Jan 26 21:26 ../ lrwxrwxrwx 1 root root 1 May 31 2022 .fs_state -> 2 drwx------ 2 root root 16384 May 30 2022 lost+found/ drwxr-xr-x 9 root root 4096 May 31 2022 upper/ drwxr-xr-x 3 root root 4096 May 31 2022 work/ hiroshi@omvpi:~ $
LinuxのソフトウェアRAID(mdadm)の RAID-1(ミラーリング)を構成していたディスクは、1台だけ取り外してほかのシステムに接続しても、比較簡単に中身を読むことができる。
もともとのマシンがぶっ壊れても、他のマシンにつなげば中身を読めるのは安心感があってよい。
以下は、よく分からずに試行錯誤していたときのログ。
実際にはやる必要のなかった無駄な操作が多く含まれているが、何かの参考になるかもしれないので残しておく。
hiroshi@omvpi:~ $ dmesg : [ 8929.274103] usb 1-1.2: new high-speed USB device number 3 using xhci_hcd [ 8929.471725] usb 1-1.2: New USB device found, idVendor=152d, idProduct=9561, bcdDevice=81.36 [ 8929.471749] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=5 [ 8929.471762] usb 1-1.2: Product: JMS56x Series [ 8929.471772] usb 1-1.2: Manufacturer: JMicron [ 8929.471781] usb 1-1.2: SerialNumber: 00000000000000000000 [ 8929.482805] scsi host0: uas [ 8929.486632] scsi 0:0:0:0: Direct-Access ST3000DM 007-1WY10G 8136 PQ: 0 ANSI: 6 [ 8929.522498] sd 0:0:0:0: [sda] 5860533168 512-byte logical blocks: (3.00 TB/2.73 TiB) [ 8929.522865] scsi 0:0:0:1: Direct-Access ST3000DM 007-1WY10G 8136 PQ: 0 ANSI: 6 [ 8929.523223] sd 0:0:0:0: [sda] Write Protect is off [ 8929.523232] sd 0:0:0:0: [sda] Mode Sense: 67 00 10 08 [ 8929.524723] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 8929.525334] sd 0:0:0:0: [sda] Preferred minimum I/O size 4096 bytes [ 8929.525343] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of preferred minimum block size (4096 bytes) [ 8929.601685] sd 0:0:0:1: [sdb] 5860533168 512-byte logical blocks: (3.00 TB/2.73 TiB) [ 8929.602395] sd 0:0:0:1: [sdb] Write Protect is off [ 8929.602413] sd 0:0:0:1: [sdb] Mode Sense: 67 00 10 08 [ 8929.604127] sd 0:0:0:1: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 8929.604679] sda: sda1 sda2 sda3 [ 8929.604841] sd 0:0:0:1: [sdb] Preferred minimum I/O size 4096 bytes [ 8929.604856] sd 0:0:0:1: [sdb] Optimal transfer size 33553920 bytes not a multiple of preferred minimum block size (4096 bytes) [ 8929.605963] sd 0:0:0:0: [sda] Attached SCSI disk [ 8929.611992] sd 0:0:0:1: [sdb] Attached SCSI disk [ 8929.621925] sd 0:0:0:0: Attached scsi generic sg0 type 0 [ 8929.622143] sd 0:0:0:1: Attached scsi generic sg1 type 0 [ 8930.035279] block device autoloading is deprecated and will be removed. [ 8930.039552] block device autoloading is deprecated and will be removed. [ 8930.050350] block device autoloading is deprecated and will be removed. : hiroshi@omvpi:~ $ sudo fdisk -l /dev/sd? Disk /dev/sda: 2.73 TiB, 3000592982016 bytes, 5860533168 sectors Disk model: 007-1WY10G Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Disk identifier: 36F7B8D6-ED67-4C9C-A0A9-51CD930408B4 Device Start End Sectors Size Type /dev/sda1 64 8388671 8388608 4G Linux RAID /dev/sda2 8388672 9437247 1048576 512M Linux RAID /dev/sda3 9437248 5860529072 5851091825 2.7T Linux RAID Disk /dev/sdb: 2.73 TiB, 3000592982016 bytes, 5860533168 sectors Disk model: 007-1WY10G Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ ll /dev/md* -bash: ll: command not found hiroshi@omvpi:~ $ ls -l /dev/md* brw-rw---- 1 root disk 9, 125 Jan 25 22:30 /dev/md125 brw-rw---- 1 root disk 9, 126 Jan 25 22:30 /dev/md126 brw-rw---- 1 root disk 9, 127 Jan 25 22:30 /dev/md127 hiroshi@omvpi:~ $ * /dev/sda が openwrt から取り外した RAID-1 を構成していたディスクのうちの1本 hiroshi@omvpi:~ $ cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md125 : inactive sda3[0](S) 2925413816 blocks super 1.2 md126 : inactive sda1[0](S) 4189184 blocks super 1.2 md127 : inactive sda2[0](S) 522240 blocks super 1.2 unused devices: <none> hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ sudo mdadm --detail /dev/md* /dev/md125: Version : 1.2 Raid Level : raid1 Total Devices : 1 Persistence : Superblock is persistent State : inactive Working Devices : 1 Name : OpenWrt:3 UUID : bee41517:55b3802c:f9404605:bc06b2d9 Events : 20919 Number Major Minor RaidDevice - 8 3 - /dev/sda3 /dev/md126: Version : 1.2 Raid Level : raid1 Total Devices : 1 Persistence : Superblock is persistent State : inactive Working Devices : 1 Name : OpenWrt:1 UUID : d1675450:f945d915:a2ae2789:536908f1 Events : 48 Number Major Minor RaidDevice - 8 1 - /dev/sda1 /dev/md127: Version : 1.2 Raid Level : raid0 Total Devices : 1 Persistence : Superblock is persistent State : inactive Working Devices : 1 Name : OpenWrt:2 UUID : 133d7fd3:01209fbf:5004cb32:421736b5 Events : 0 Number Major Minor RaidDevice - 8 2 - /dev/sda2 hiroshi@omvpi:~ $ Number Major Minor RaidDevice - 8 3 - /dev/sda3 - 8 1 - /dev/sda1 - 8 2 - /dev/sda2 * mdadm.conf の内容(初期状態) hiroshi@omvpi:~ $ cat /etc/mdadm/mdadm.conf # mdadm.conf # # !NB! Run update-initramfs -u after updating this file. # !NB! This will ensure that initramfs has an uptodate copy. # # Please refer to mdadm.conf(5) for information about this file. # # by default (built-in), scan all partitions (/proc/partitions) and all # containers for MD superblocks. alternatively, specify devices to scan, using # wildcards if desired. #DEVICE partitions containers # automatically tag new arrays as belonging to the local system HOMEHOST <system> # instruct the monitoring daemon where to send mail alerts MAILADDR root # definitions of existing MD arrays # This configuration was auto-generated on Sat, 18 Jan 2025 23:15:35 +0900 by mkconf hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 2.7T 0 disk ├─sda1 8:1 0 4G 0 part │ └─md126 9:126 0 0B 0 md ├─sda2 8:2 0 512M 0 part │ └─md127 9:127 0 0B 0 md └─sda3 8:3 0 2.7T 0 part └─md125 9:125 0 0B 0 md sdb 8:16 0 2.7T 0 disk mmcblk0 179:0 0 7.4G 0 disk ├─mmcblk0p1 179:1 0 512M 0 part /boot/firmware └─mmcblk0p2 179:2 0 6.9G 0 part /var/folder2ram/var/cache/samba /var/folder2ram/var/lib/monit /var/folder2ram/var/lib/rrdcached /var/folder2ram/var/spool /var/folder2ram/var/lib/openmediavault/rrd /var/folder2ram/var/tmp /var/folder2ram/var/log / hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ sudo parted /dev/md125 print Warning: Error fsyncing/closing /dev/md125: Input/output error Retry/Ignore? r Warning: Error fsyncing/closing /dev/md125: Input/output error Retry/Ignore? i hiroshi@omvpi:~ $ sudo parted /dev/md126 print Warning: Error fsyncing/closing /dev/md126: Input/output error Retry/Ignore? i hiroshi@omvpi:~ $ sudo parted /dev/md127 print Warning: Error fsyncing/closing /dev/md127: Input/output error Retry/Ignore? i hiroshi@omvpi:~ $ * OpenWRTでは、どんな風になっていたのか(現行のディスクをチェックしてみる) BusyBox v1.35.0 (2023-01-03 00:24:21 UTC) built-in shell (ash) _______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M ----------------------------------------------------- OpenWrt 22.03.3, r20028-43d71ad93e ----------------------------------------------------- root@OpenWrt:~# root@OpenWrt:~# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 3072 3072 0 100% /rom tmpfs 125772 87464 38308 70% /tmp /dev/ubi0_1 106184 21136 80208 21% /overlay overlayfs:/overlay 106184 21136 80208 21% / tmpfs 512 0 512 0% /dev /dev/md3 5762648500 3634764892 1835083632 66% /mnt/md3 /dev/md1 4041440 44160 3771440 1% /mnt/md1 root@OpenWrt:~# cat /proc/mdstat Personalities : [raid0] [raid1] [raid10] md1 : active raid1 sda1[3] sdb1[2] 4189184 blocks super 1.2 [2/2] [UU] md3 : active raid1 sda3[3] sdb3[2] 5855671847 blocks super 1.2 [2/2] [UU] bitmap: 0/22 pages [0KB], 131072KB chunk unused devices: <none> root@OpenWrt:~# 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 Disklabel type: gpt Disk identifier: 875A90EA-FE1C-4FE0-9649-DB24155B5A85 Device Start End Sectors Size Type /dev/sda1 64 8388671 8388608 4G Linux RAID /dev/sda2 8388672 9437247 1048576 512M Linux RAID /dev/sda3 9437248 11721045134 11711607887 5.5T Linux RAID 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 Disklabel type: gpt Disk identifier: F11EE5F2-D7CE-4738-AA86-59F981999363 Device Start End Sectors Size Type /dev/sdb1 64 8388671 8388608 4G Linux RAID /dev/sdb2 8388672 9437247 1048576 512M Linux RAID /dev/sdb3 9437248 11721045134 11711607887 5.5T Linux RAID root@OpenWrt:~# root@OpenWrt:~# mdadm --detail /dev/md* /dev/md1: Version : 1.2 Creation Time : Mon May 30 21:03:48 2022 Raid Level : raid1 Array Size : 4189184 (4.00 GiB 4.29 GB) Used Dev Size : 4189184 (4.00 GiB 4.29 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Sun Jan 26 13:50:51 2025 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Consistency Policy : resync Name : OpenWrt:1 (local to host OpenWrt) UUID : d1675450:f945d915:a2ae2789:536908f1 Events : 70 Number Major Minor RaidDevice State 3 8 1 0 active sync /dev/sda1 2 8 17 1 active sync /dev/sdb1 /dev/md3: Version : 1.2 Creation Time : Fri May 27 21:35:24 2022 Raid Level : raid1 Array Size : 5855671847 (5584.40 GiB 5996.21 GB) Used Dev Size : 5855671847 (5584.40 GiB 5996.21 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Intent Bitmap : Internal Update Time : Sun Jan 26 13:51:22 2025 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Consistency Policy : bitmap Name : OpenWrt:3 (local to host OpenWrt) UUID : bee41517:55b3802c:f9404605:bc06b2d9 Events : 24640 Number Major Minor RaidDevice State 3 8 3 0 active sync /dev/sda3 2 8 19 1 active sync /dev/sdb3 root@OpenWrt:~# root@OpenWrt:~# cat /etc/config/mdadm config mdadm option email root # list devices /dev/hd* # list devices /dev/sd* # list devices partitions #config array # option device /dev/md2 # option name OpenWrt:2 # list devices /dev/sda2 # list devices /dev/sdb2 config array option device /dev/md3 option name OpenWrt:3 list devices /dev/sda3 list devices /dev/sdb3 config array option device /dev/md1 option name OpenWrt:1 list devices /dev/sda1 list devices /dev/sdb1 root@OpenWrt:~# root@OpenWrt:~# mdadm --examine --scan /dev/sd[ab][13] ARRAY /dev/md/3 metadata=1.2 UUID=bee41517:55b3802c:f9404605:bc06b2d9 name=OpenWrt:3 ARRAY /dev/md/1 metadata=1.2 UUID=d1675450:f945d915:a2ae2789:536908f1 name=OpenWrt:1 root@OpenWrt:~# * こっちでも同じこと root@OpenWrt:~# mdadm --examine --brief --scan --config=partitions ARRAY /dev/md/1 metadata=1.2 UUID=d1675450:f945d915:a2ae2789:536908f1 name=OpenWrt:1 ARRAY /dev/md/3 metadata=1.2 UUID=bee41517:55b3802c:f9404605:bc06b2d9 name=OpenWrt:3 root@OpenWrt:~# *ラズパイ側に戻る こう出てくる hiroshi@omvpi:~ $ sudo mdadm --examine --brief --scan --config=partitions ARRAY /dev/md/1 metadata=1.2 UUID=d1675450:f945d915:a2ae2789:536908f1 name=OpenWrt:1 ARRAY /dev/md/2 metadata=1.2 UUID=133d7fd3:01209fbf:5004cb32:421736b5 name=OpenWrt:2 ARRAY /dev/md/3 metadata=1.2 UUID=bee41517:55b3802c:f9404605:bc06b2d9 name=OpenWrt:3 hiroshi@omvpi:~ $ こうなってる hiroshi@omvpi:~ $ cat /etc/mdadm/mdadm.conf # mdadm.conf # # !NB! Run update-initramfs -u after updating this file. # !NB! This will ensure that initramfs has an uptodate copy. # # Please refer to mdadm.conf(5) for information about this file. # # by default (built-in), scan all partitions (/proc/partitions) and all # containers for MD superblocks. alternatively, specify devices to scan, using # wildcards if desired. #DEVICE partitions containers # automatically tag new arrays as belonging to the local system HOMEHOST <system> # instruct the monitoring daemon where to send mail alerts MAILADDR root # definitions of existing MD arrays # This configuration was auto-generated on Sat, 18 Jan 2025 23:15:35 +0900 by mkconf hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ ls -alF /dev/md* brw-rw---- 1 root disk 9, 125 Jan 25 23:31 /dev/md125 brw-rw---- 1 root disk 9, 126 Jan 25 23:31 /dev/md126 brw-rw---- 1 root disk 9, 127 Jan 25 23:31 /dev/md127 hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ sudo mv /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf.ORIGINAL hiroshi@omvpi:~ $ sudo vi /etc/mdadm/mdadm.conf hiroshi@omvpi:~ $ cat /etc/mdadm/mdadm.conf ARRAY /dev/md1 metadata=1.2 UUID=d1675450:f945d915:a2ae2789:536908f1 name=OpenWrt:1 ARRAY /dev/md2 metadata=1.2 UUID=133d7fd3:01209fbf:5004cb32:421736b5 name=OpenWrt:2 ARRAY /dev/md3 metadata=1.2 UUID=bee41517:55b3802c:f9404605:bc06b2d9 name=OpenWrt:3 hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ sudo mdadm -A -s hiroshi@omvpi:~ $ sudo reboot hiroshi@omvpi:~ $ sudo rm /dev/md12 md125 md126 md127 hiroshi@omvpi:~ $ sudo rm /dev/md12* hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ sudo mdadm -A -s hiroshi@omvpi:~ $ ls /dev/m mapper/ media0 media1 media2 media3 mem mmcblk0 mmcblk0p1 mmcblk0p2 mqueue/ hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ sudo mdadm --create /dev/md3 --level=1 --raid-devices=1 /dev/sda3 mdadm: '1' is an unusual number of drives for an array, so it is probably a mistake. If you really mean it you will need to specify --force before setting the number of drives. hiroshi@omvpi:~ $ sudo mdadm --create /dev/md3 --level=1 --raid-devices=1 /dev/sda3 --force mdadm: cannot open /dev/sda3: Device or resource busy hiroshi@omvpi:~ $ ===== Linux omvpi 6.6.62+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.62-1+rpt1 (2024-11-25) aarch64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Sun Jan 26 15:41:19 2025 from 2001:c90:8440:4e89:e5da:40d5:b3f2:8ab7 hiroshi@omvpi:~ $ ls /dev/md12 md125 md126 md127 hiroshi@omvpi:~ $ sudo update-initramfs -u update-initramfs: Generating /boot/initrd.img-6.6.62+rpt-rpi-v8 '/boot/initrd.img-6.6.62+rpt-rpi-v8' -> '/boot/firmware/initramfs8' update-initramfs: Generating /boot/initrd.img-6.6.62+rpt-rpi-2712 '/boot/initrd.img-6.6.62+rpt-rpi-2712' -> '/boot/firmware/initramfs_2712' hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ ls -l /dev/md* brw-rw---- 1 root disk 9, 1 Jan 26 16:37 /dev/md1 brw-rw---- 1 root disk 9, 2 Jan 26 16:37 /dev/md2 brw-rw---- 1 root disk 9, 3 Jan 26 16:37 /dev/md3 hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ ls -l /dev/md* brw-rw---- 1 root disk 9, 1 Jan 26 16:37 /dev/md1 brw-rw---- 1 root disk 9, 2 Jan 26 16:37 /dev/md2 brw-rw---- 1 root disk 9, 3 Jan 26 16:37 /dev/md3 hiroshi@omvpi:~ $ cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md3 : inactive sda3[0](S) 2925413816 blocks super 1.2 md2 : inactive sda2[0](S) 522240 blocks super 1.2 md1 : inactive sda1[0](S) 4189184 blocks super 1.2 unused devices: <none> hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ sudo mount /dev/md3 /mnt/raiddisk3 mount: /mnt/raiddisk3: can't read superblock on /dev/md3. dmesg(1) may have more information after failed mount system call. mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. hiroshi@omvpi:~ $ [ 3015.764373] mount: attempt to access beyond end of device md3: rw=4096, sector=2, nr_sectors = 2 limit=0 [ 3015.764395] EXT4-fs (md3): unable to read superblock hiroshi@omvpi:~ $ sudo mkfs.ext4 -n /dev/md3 mke2fs 1.47.0 (5-Feb-2023) mkfs.ext4: Device size reported to be zero. Invalid partition specified, or partition table wasn't reread after running fdisk, due to a modified partition being busy and in use. You may need to reboot to re-read your partition table. hiroshi@omvpi:~ $ sudo fsck /dev/md3 -p fsck from util-linux 2.38.1 fsck.ext2: Invalid argument while trying to open /dev/md3 /dev/md3: The superblock could not be read or does not describe a valid ext2/ext3/ext4 filesystem. If the device is valid and it really contains an ext2/ext3/ext4 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 8193 <device> or e2fsck -b 32768 <device> hiroshi@omvpi:~ $
hiroshi@omvpi:~ $ cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md3 : inactive sda3[0](S) 2925413816 blocks super 1.2 md2 : inactive sda2[0](S) 522240 blocks super 1.2 md1 : inactive sda1[0](S) 4189184 blocks super 1.2 unused devices: <none> hiroshi@omvpi:~ $ sudo mdadm --run /dev/md3 mdadm: started array /dev/md3 hiroshi@omvpi:~ $ sudo mount /dev/md3 /mnt/raiddisk3 mount: (hint) your fstab has been modified, but systemd still uses the old version; use 'systemctl daemon-reload' to reload. hiroshi@omvpi:~ $ ls /mnt/raiddisk3 TESTFILE homes lost+found share users hiroshi@omvpi:~ $ ls -l /mnt/raiddisk3 total 32 -rw-r--r-- 1 root root 29 May 28 2022 TESTFILE drwxr-xr-x 3 root root 4096 May 28 2022 homes drwx------ 2 root root 16384 May 28 2022 lost+found drwxrwxrwx 8 nobody root 4096 Oct 15 2022 share drwxr-xr-x 6 nobody root 4096 Nov 23 2022 users hiroshi@omvpi:~ $ hiroshi@omvpi:~ $ cat /proc/mdstat Personalities : [raid1] [linear] [raid0] [raid6] [raid5] [raid4] [raid10] md3 : active (auto-read-only) raid1 sda3[0] 2925413760 blocks super 1.2 [2/1] [U_] bitmap: 3/22 pages [12KB], 65536KB chunk md2 : inactive sda2[0](S) 522240 blocks super 1.2 md1 : inactive sda1[0](S) 4189184 blocks super 1.2 unused devices: <none> hiroshi@omvpi:~ $
nas/mount_raiddisk_another.txt · 最終更新: 2025/01/26 21:51 by nipa28