Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to set up a mirrored (RAID 1) "file cabinet" consisting of the remainder of sda, after "/" and swap have been set up and Ubuntu installed, plus the equal amount of Gb space on sdb, amounting to a RAID 1 on sda3 and sdb1.

In my opinion, mirroring is neither necessary nor desired for the rest of Linux, since anything that corrupts my root/boot sector on the one HDD would just be duplicated on the other HDD; all I need, and want, is a RAID 1 "file cabinet" set up AFTER the installation of Ubuntu 14.04.

I don't figure that there are many folk who have tried this, but I would be happily surprised if everyone has done it!

What I would like to know is the step by step syntax, in mdadm, for how to do this (I have already downloaded/installed mdadm), in language that you'd use to explain this - or anything else - to a noob, please!

Thanks! Pathfinder : -) Tag-1: groundbreaking Tag-2: outsidethebox Tag-3: notforpissants Tag-4: edgecity

share|improve this question

1 Answer 1

First, change the type of the sda3 and sdb1 partition to be Linux raid autodetect :

sudo fdisk /dev/sda
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): fd

Command (m for help): w

sudo fdisk /dev/sdb
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): fd

Command (m for help): w

sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb1
sudo mdadm --examine --scan | sudo tee -a /etc/mdadm/mdadm.conf

The last 2 commands create an empty raid device called /dev/md0 from the two partitions and update the configuration file for the system to find back easily the RAID you've just configured.

The rest of the operation is "usual" filesystem creation and activation :

sudo mkfs.ext4 /dev/md0
sudo mkdir /mount/point     <-- create the directory where you want your RAID data partition be mounted

Edit the /etc/fstab file to let the system mount your new data RAID partition automatically by adding the following line to it :

/dev/md0  /mount/point  ext4  noatime,rw 0 2

Then, by simply doing sudomount /mount/point, your filesystem will be mounted and available for use.

If you reboot the server, detection, assembly and mounting of the RAID filesystem will be done automatically.

share|improve this answer
    
Merci Benoit! Sorry for the tardiness, I thought I posed this on Ubuntu Forums, then finally remembered it was HERE! OOPS, hitting the return button only POSTS the comment! I wanted to ask about the "(M for help)" bit... I'm unfamiliar with this, do I write, for example, "t" (or "w", etc.), or must I invoke a "Command" function first, or what? Also, "sudo" doesn't get me to root privileges, while "sudo su" does, tho that's a detail! I'll spend some time checking out the syntax before doing anything, and if there's MORE that stumps me, I'll... BE BACK! : -) Thanks again! (Cheeky) Pathfinder –  user301443 Jul 11 at 2:13
    
Hi Benoit, is this correct? /*Assuming I have invoked root privileges... fdisk /dev/sda t 3 fd /*The above converts sda3 to Linux raid autodetect w /*Hi, stranger! : -) fdisk /dev/sdb t 1 fd /*The above converts sdb1 to Linux raid autodetect w /*Hi again, stranger! : -) mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb1 mdadm --examine --scan | sudo tee -a /etc/mdadm/mdadm.conf /*The above creates the RAID 1 volume out of sda3 and sdb1 Thx! (Pathfinder) –  user301443 Jul 11 at 2:43
    
This is UTTERLY CRAPPY - it TRASHES all formatting! –  user301443 Jul 11 at 2:44
    
Oh, I meant to ask additionally, is there any reason why I can't/ shouldn't use the Btrfs ["btr" pronounced "better" : -)] file system?? Thx! –  user301443 Jul 11 at 2:49
    
Thanks again, Benoit, and sorry for being a hopeless sap! I think I'll be able to do this/ figure out the syntax, adapting the syntax of the following website to your syntax above: tldp.org/HOWTO/Flash-Memory-HOWTO/ext2.html. –  user301443 Jul 12 at 4:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.