Score:0

Fresh install of Ubuntu Server - Will raid (MDADM) be detected without losing data?

np flag

hoping you can help me. My server's current boot drive appears to be dead. I can't boot. Internally i have four drives. The last three were set up as raid 5 with mdadm. The drive in slot 1 was just a standard storage drive with nothing on it that i don't already have backed up elsewhere.

my main question is, if i perform a fresh ubuntu server install onto drive 1, will i be able to detect my raid (drive 2-4) without loosing all of the data stored. sorry if i'm not specific or technical enough.

Score:0
pl flag

After installing the server, yes, it is possible to recover the MD RAID array. There are plenty of guides to do this online if you search for mdadm and reassemble which are the right words.

Essentially you want to first check that the array is there on boot by looking at cat /proc/mdstat which should reveal the /dev/mdX name, and which devices are in the array, and what kinda of array. For example, this is an active RAID 5 array on /dev/md0 comprising partitions across drives /dev/sdd4, /dev/sdb2, /dev/sda0, and /dev/sdc1.

alan@earth:~$ cat /proc/mdstat 
Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] 
md0 : active raid5 sdd[4] sdb[2] sda[0] sdc[1]
      8790402048 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]
      bitmap: 8/22 pages [32KB], 65536KB chunk

Yours may look different, but that's roughly what you should get.

If you don't, you can use the following command to scan (but this shouldn't be necessary as I believe Ubuntu will scan on boot).

sudo mdadm --assemble --scan --verbose

Once you have the device name, you can test mounting it with a simple sudo mkdir /mnt/array && sudo mount /dev/md0 /mnt/array and check out the files in /mnt/array. If that's all good you can add an entry to your /etc/fstab to mount on boot.

David Royston King avatar
np flag
Thankyou, that's exactly what i needed to hear. I know my array was set on sdc, sdd and sde. Which are located on internal drives 2-4. My original boot drive was on an external, I had used to migrate an older system. I never got around to cloning it to my internal drive 1. That drive is now dead. Thank you for your help
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.