#1  
Old 7th December 2012, 23:54
pligor pligor is offline
Junior Member
 
Join Date: Dec 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Arrow raid-1 on ubuntu 12.04

I was following this tutorial: http://www.howtoforge.com/how-to-set...buntu-11.10-p2

and I tried to recreate it for ubuntu 12.04 since a lot of things have changed.

Don't be scared with the length of this thread. It is really only the first two pages of the tutorial in a nutshell. It is the procedure I followed while I was trying to create a raid-1 on a running system that now has two identical disk drives.

Please try to follow it to see what is wrong because the tutorial of raid-1 for ubuntu 12.04 would be very useful and now is missing!

This is the procedure (not working yet):
Code:
just to see which disks are detected
	cat /proc/diskstats
	or
	sudo lshw -c storage -c disk

Typically is sdb
Format your drive using the disk utility
    In Disk Utily use default Master Boot Record

Take all the partition configuration from sda and put it in sdb. We want an exact copy so this is the first step
	sudo sfdisk -d /dev/sda | sfdisk --force /dev/sdb
		
To format the drive
  sudo fdisk /dev/sdb

for all partitions (sdb1 and sdb5) do the following:
		Type 't' to change the partition's system id
		Choose partition number
		Type 'L' to list all codes
		choose the code "fd" for Linux raid auto
		finally on the main menu type 'w' to write (save) all the changes and quit
	
install mdadm
	sudo apt-get install mdadm
	
To make sure that there are no remains from previous RAID installations on /dev/sdb, we run the following commands:
	sudo mdadm --zero-superblock /dev/sdb1
	sudo mdadm --zero-superblock /dev/sdb5

create raid-array
	//sudo mdadm --create --verbose --auto=yes /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb	
	sudo mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1
	sudo mdadm --create /dev/md1 --level=1 --raid-disks=2 missing /dev/sdb5
	
to verify execute this:
	cat /proc/mdstat
	should now show that you have two degraded RAID arrays ([_U] or [U_] means that an array is degraded while [UU] means that the array is ok)
	
Create filesystems on raid arrays
	//sudo mkfs.ext4 /dev/md0
	sudo mkfs.ext2 /dev/md0
	sudo mkswap /dev/md1

Set new mdadm configuration by first backing up the original
	sudo cp /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf_orig

execute the line below to save to a temporary file
	sudo mdadm --examine --scan > temporary.txt
	copy and paste at the end(append) of this file:
		sudo nano /etc/mdadm/mdadm.conf
		or
		sudo gedit /etc/mdadm/mdadm.conf
	and of course delete temporary file
		sudo rm temporary.txt
		
Next we modify /etc/fstab. Comment out the current /, /boot, and swap partitions and
add new lines for them where you replace the UUIDs with /dev/md0 (for the / partition) and /dev/md5 (for the swap partition), AGAIN don't know for third one
	sudo nano /etc/fstab
	or
	sudo gedit /etc/fstab
	
Next replace /dev/sda1 with /dev/md0 in /etc/mtab:
	sudo nano /etc/mtab
	or
	sudo gedit /etc/mtab
	
Now up to the GRUB2 boot loader. Create the file /etc/grub.d/09_swraid1_setup as follows
	sudo cp /etc/grub.d/40_custom /etc/grub.d/09_swraid1_setup
	sudo nano /etc/grub.d/09_swraid1_setup
	or
	sudo gedit /etc/grub.d/09_swraid1_setup
	Copy paste this inside:
		menuentry 'Ubuntu, with Linux 3.2' --class ubuntu --class gnu-linux --class gnu --class os {
				    insmod raid
				    insmod mdraid
				    insmod part_msdos
				    insmod ext2
				    set root='(md/0)'
				    echo    'Loading Linux 3.2.0-34-generic ...'
				    linux   /vmlinuz-3.2.0-34-generic root=/dev/md0 ro  quiet
				    echo    'Loading initial ramdisk ...'
				    initrd  /initrd.img-3.2.0-34-generic
		}
	Make sure you use the correct kernel version in the menuentry stanza (in the linux and initrd lines). You can find it out by running
		uname -r

Because we don't use UUIDs for our block devices, open /etc/default/grub...
	sudo nano /etc/default/grub
	or
	sudo gedit /etc/default/grub
...and uncomment the line GRUB_DISABLE_LINUX_UUID=true

set BOOT_DEGRADED to true so that the system can boot from a degraded array without asking 
	sudo nano /etc/initramfs-tools/conf.d/mdadm
	or
	sudo gedit /etc/initramfs-tools/conf.d/mdadm

Now run
	sudo update-grub
	
Next we adjust our ramdisk to the new situation:
	sudo update-initramfs -u

Now let's mount /dev/md0 (we don't need to mount the swap array /dev/md5):
	sudo mkdir /mnt/md0
	sudo mount /dev/md0 /mnt/md0
	
Next we change the partition type of /dev/sda5 to Linux raid autodetect and add /dev/sda5 to the /dev/md1 array:
	sudo fdisk /dev/sda
	
SUGGESTION HERE IS TO CREATE A Linux raid autodetect ONLY FOR THE SWAP PARTITION! Does this makes sense or should we do it for the main partition as well??
But even if we try the first attemtp to add the device to the array:
	sudo mdadm --add /dev/md1 /dev/sda5
does NOT succeeed !

Now we copy the contents of /dev/sda1 to /dev/md0	
Attempt to Copy 1:
	cd /boot
	sudo cp -dpRx . /mnt/md0

Attempt to Copy 2:
	sudo cp -dpRx / /mnt/md0

You should now the md0 array in the output of:
	mount
	
Afterwards we must make sure that the GRUB2 bootloader is installed on both hard drives, /dev/sda and /dev/sdb:
	sudo grub-install /dev/sda
	sudo grub-install /dev/sdb
	
reboot
Reply With Quote
Sponsored Links
  #2  
Old 9th December 2012, 22:41
pligor pligor is offline
Junior Member
 
Join Date: Dec 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
 
Question adding main device into raid-array not working

This command is successful:
mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1

However when I am trying to add the main device with this command:
mdadm --add /dev/md0 /dev/sda1
I get an error message that the device is busy.

Should I execute the whole tutorial from a live cd ?? But then all the configurations would happen on the system of the live cd not the installed one...

Any tip would be greatly appreciated!
Reply With Quote
Reply

Bookmarks

Tags
raid1, ubuntu 12.04

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
configure RAID 1 with different size disks with software-raid under ubuntu qiubosu Installation/Configuration 0 24th October 2012 23:24
Intel ESRT2, Matrix RAID or Ubuntu Software Raid? dalitso Installation/Configuration 0 4th October 2010 17:19
Raid 1 ubuntu on intel se7230 statiic Installation/Configuration 1 22nd September 2010 14:02
Connection timed out on intermail outgoing mails gouravgarg Server Operation 6 5th March 2010 20:31
Unbale to login to Postfix from webmail wasimriz HOWTO-Related Questions 5 6th April 2009 13:49


All times are GMT +2. The time now is 19:09.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.