Removing mdadm array and converting to regular disks while preserving data
Solution 1
What I ended up doing was repeating this procedure until I had all of the files off.
- mdadm /dev/md0 --fail /dev/sd... --remove /dev/sd...
- mdadm --zero-superblock /dev/sd...
- mkfs.ext4 /dev/sd...
- resize2fs /dev/md0 (disk size)
- Copying 2TB of data to /dev/sd...
- Go to step 1 until all of data is off of md0.
After this is all done I did the following:
- mdadm --stop /dev/md0
- mdadm --remove /dev/md0
All went well and I didn't even loose any data. Obviously you should back up your data, but in my case backing up 6TB isn't really feasible. Therefore, I was willing to take the risk. There were a lot of vulnerability points to this process and it takes a long time. I'd urge you to only do this with data you either have backed up or can easily recreate.
Solution 2
Well, you have RAID5 on 6 2TB disks which gives you 10TB usable space, 50% of which is used by data - that's 5TB you have to put somewhere. I don't think you can do this any other way without having additional disks. Which doesn't really help you.
However I wanted to note one thing - you'll be moving part of this dataset to a single disk, which gives you no redundancy and after that you'll be resizing the raid5 set which may result in its corruption in the process.
From what you plan to do and the constraints you described I understood you do not have a backup of this dataset. Are you sure you want to do it this way without first moving the data somewhere else? This sounds like an overly optimistic approach :)
Related videos on Youtube
Jeffrey Kevin Pry
Updated on September 18, 2022Comments
-
Jeffrey Kevin Pry almost 2 years
I have a 6 disk (2TB each) mdadm RAID 5 volume created in Ubuntu 12.04 Server. However, I'm moving to a different solution and want to "unraid" my disks but keep the data. Only 50% is in use.
From what I can surmise I basically have to do this recursively for each physical disk.
- Fail the disk
- Format the failed disk
- Move a portion of files to the new disk.
- Reshape the array
- Shrink the logical volume md0
This seems like a very time consuming process. Is there an easier way to do this (automatically perhaps) without buying new disks to temporarily hold the data?
I am also aware that during this processing my RAID volume will be degraded and vulnerable the entire time. I am not too concerned about this and will be using battery backup and moving the most important files off first.
Thank you for your help!
-
Admin over 11 yearsAnyone have any ideas?
-
Admin over 11 yearsWhat is this new solution? Why is leaving the RAID set not an option? Indeed reshaping an array is time consuming.
-
Admin over 11 yearsWhat I ended up doing was marking one disk as faulty, resizing the filesystem, and then reshaping the array. When the disk was removed I then formatted it as ext4 and moved 2TB of data to the drive... etc etc. Took forever... But all data intact :)
-
Jeffrey Kevin Pry over 11 yearsNo sense in letting the bounty go to waste. Here you go :)
-
Marcin Kaminski over 11 yearsThat's generous :) Thank you very much. I see you like the adrenaline, but I'm glad you got lucky. This time :>