Monday, July 25, 2005

Creating a mirrored, non-boot/root, filesystem (linux)

Recently I had to take free space from 2 drives and create a mirrored filesystem. Here's what I did:

1) Environment: 2 drives on hda and hdb

2) fdisk /dev/hda
i. Create a "Linux raid autodetect" partition (choose "fd") according to your needs.

3) fdisk /dev/hdb
i. As with /dev/hda, create an "fd" partition.

4) mdadm --create /dev/md4 --level=1 --raid-devices=2 /dev/hd[ab]6
* this line creates a md device using /dev/hda6 and /dev/hdb6. It also starts the raid device.

5) Create your filesystem on /dev/md4:
i. mkfs -t ext2 /dev/md4
* I chose a non-journaled filesystem because Oracle already does this for you, in a sense.

6) Edit /etc/mdtab to reflect your changes, followed by /etc/fstab:
i. Add a single entry to mtab: /dev/md4 /u01 ext2 rw 0 0
ii. Now fstab: /dev/md4 /u01 ext2 defaults 0 0

A more thorough description of this process, done slightly differently, but including information on Grub and mirroring the boot disk, can be found at:
http://www.linuxsa.org.au/mailing-list/2003-07/1270.html

0 comments: