recover two usb drives raid1 after system failure
with a raspberrypi (hostname: homer) I had set up a raid1 with two usb drives of 5Tb using mdadm. All worked perfect until the system failed.
After connecting the two drives on my laptop lsblk -f gives the following output (part): sdc └─sdc1 linux_r homer:0 a3e7388f-b23e-585f-c61c-9573d129fca1 └─md127 ext4 5c40fa6a-ee42-40a9-a45b-d04da893b67d /media/ed/ sdd └─sdd1 linux_r homer:0 a3e7388f-b23e-585f-c61c-9573d129fca1 Until now I have not written anything to the drives. When I inspect the md127 (/dev/sdc1), it seems that all the files are present. But I don't see anything on /dev/sdd1. My simple (?) question is: can I recover the two drives as raid1 again without dataloss? I hope someone can help me. It's about 1 Tb data. Thanks in advance, kind regards Ed |
an additional question:
does the command: "mdadm --create /dev/md0 --level=1 /dev/sdx1 /dev/sdy1" with the right arguments, destroy the data on the intact usb drive? |
Yes.
Post the output of the command: sudo mdadm -D /dev/md127 It will just output status and details of the RAID. It will not change anything. Quote:
|
Yes, one disk is mounted to /media/ed.
This is the output: ed@laptop ~ $ sudo mdadm -D /dev/md127 mdadm: ARRAY line RD_NA9W41BP-0:0 has no identity information. /dev/md127: Version : 1.2 Creation Time : Sat Aug 3 00:16:38 2019 Raid Level : raid1 Array Size : 4883637248 (4657.40 GiB 5000.84 GB) Used Dev Size : 4883637248 (4657.40 GiB 5000.84 GB) Raid Devices : 2 Total Devices : 1 Persistence : Superblock is persistent Intent Bitmap : Internal Update Time : Fri Jan 17 17:41:11 2020 State : clean, degraded Active Devices : 1 Working Devices : 1 Failed Devices : 0 Spare Devices : 0 Consistency Policy : bitmap Name : homer:0 UUID : a3e7388f:b23e585f:c61c9573:d129fca1 Events : 318513 Number Major Minor RaidDevice State 0 8 33 0 active sync /dev/sdc1 - 0 0 1 removed ed@laptop ~ $ |
Re-create the RAID and copyyour backup onto it.
|
As stated the RAID is running but just with 1 disk in degraded mode. All the data should be ok with RAID 1 because the disks are an exact copy of each other.
Do you know if the second disk is still ok? Maybe run SMART diagnostics to check its status. You do not need to recreate the RAID but having a backup is a good idea. Status shows the second drive as removed. The second disk should be partitioned exactly like the first. To replace the second disk run the command. sudo mdadm --manage /dev/md127 --add /dev/sdx1 (make sure you use the correct device ID) To check the RAID status run the commands sudo mdadm -D /dev/md127 cat /proc/mdstat |
Quote:
So my question is: can I build the RAID1 without data loss of that drive. For instance with the similar command like: does the command: "mdadm --create /dev/md0 --level=1 /dev/sdx1 /dev/sdy1" with the right arguments, destroy the data on the intact usb drive? Let's say that /dev/sdx1 is the drive with all the data. What happens with that? |
Yes, see my post above.
Search the internet on how to replace a drive in a mdadm RAID 1 Yes, running create on an existing array drive will essentially destroy the data. It actually erases the metadata making data recovery very difficult. RAID is not a backup. It purpose is to protect against a hard drive failure which appeared to work in this case but we do not know if the drive just became corrupted or has failed. |
Let's hope the drives have external power. Personally I wouldn't re-use the failed drive, but get a new one and test the failed one at your leisure.
Get some diagnostic data - the smart data asked for already and your logs for the initial failure; I'd guess the drive now simply gets ignored at assemble, so likely no useful messages then. Without a proper backup your data are at risk whilst you are fooling with the disk(s). Simple as that. |
All times are GMT -5. The time now is 07:28 PM. |