1
1
I read How can I add a RAID 1 array in Ubuntu 10.04 and Installing Raid 1 on Existing Ubuntu Server. However, I only have the following 2 hard drives:
dev/sdb1
where Ubuntu 12.04 is currently running
dev/sda1
empty disk
I want to create a RAID on these two hard drives, but I don't want to delete the sdb1
partition because Ubuntu is working fine.
How can I create a RAID on existing device?
I performed
mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sda1
Then
mkfs -t ext2 /dev/md0
And I run
echo "DEVICE partitions" > /etc/mdadm/mdadm.conf
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Then I change boot to md0
in grub2
menuentry 'Ubuntu, with Linux 3.2.0-23-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(md0)'
search --no-floppy --fs-uuid --set=root 8fff7794-a156-46d2-92f8-4931d42abf36
linux /vmlinuz-3.2.0-23-generic root=/dev/mapper/ubuntu--server-root ro
initrd /initrd.img-3.2.0-23-generic
}
But, when I want to add
mdadm --manage /dev/md0 -a /dev/sdb1
I always get
mdadm: Cannot open /dev/sdb1: Device or resource busy
Thx for answer. can you give me en example how to add hdb1 to mirror? – senzacionale – 2012-05-07T17:20:56.397
You'll need to read the mdadm and software RAID documentation to avoid losing your data and get familiar with it. For example, are your hard drives the same size? Probably not since one is IDE and one is SATA. You'll need to ensure the RAID device you create is not too large. – MikeyB – 2012-05-07T17:23:45.740
disks are the same size. hdb1 is sdb1, my mistake sorry. both disks are SATA1 – senzacionale – 2012-05-07T17:24:35.783
i am reading mdadm but i am not sure how to mirror sdb1 – senzacionale – 2012-05-07T17:30:39.427
I already edited how to add sdb1 to the mirror into the question. – MikeyB – 2012-05-07T17:32:49.833
Thx i see. but i get root@ubuntu-server:~# mdadm --manage /dev/md0 -a /dev/sdb1 mdadm: Cannot open /dev/sdb1: Device or resource busy – senzacionale – 2012-05-07T17:34:49.077
i try stop it first and then restart but is the same. mdadm --stop /dev/md0 – senzacionale – 2012-05-07T17:39:57.793
1You need to boot using /dev/md0 first. – MikeyB – 2012-05-07T17:47:09.793
you mean changing root (hd0,msdos1) in grub to root (md0)? but i still get Device or resource busy – senzacionale – 2012-05-07T18:15:08.777
i try everything even this howto http://www.howtoforge.com/how-to-set-up-software-raid1-on-a-running-system-incl-grub2-configuration-debian-squeeze but i don't know how to boot. now i get error when booting md0
– senzacionale – 2012-05-07T19:23:01.160Did you copy the data over to it? – MikeyB – 2012-05-07T19:48:58.003
yes sfdisk -d /dev/sdb | sfdisk --force /dev/sda ke is in this howto: http://www.howtoforge.com/how-to-set-up-software-raid1-on-a-running-system-incl-grub2-configuration-debian-squeeze
– senzacionale – 2012-05-07T20:09:02.0271You made backups, right? – MikeyB – 2012-05-07T20:15:08.240