Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Single HDD (installed on) -> Dual HDD RAID 1 migration

  1. #1
    Join Date
    Oct 2008
    Location
    Liverpool, UK
    Beans
    44
    Distro
    Ubuntu

    Single HDD (installed on) -> Dual HDD RAID 1 migration

    Hi,

    I'd like advice on how to migrate all of my data from a single HDD to two new disks in RAID 1.

    I'm a fairly apt Linux user but this is something I've never had to toil in.

    I'll be purchasing the drives and then they'll arrive at the datacenter, be installed and ready for me to start configuring them.

    How would I go about configuring the RAID 1 array, copying all my data to it, and then setting it as the boot device?

    I'm running Ubuntu Linux 11.04 (Linux 2.6.38-8-server on x86_64).

    Thank you in advance.

  2. #2
    Join Date
    Oct 2009
    Beans
    2,199
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Single HDD (installed on) -> Dual HDD RAID 1 migration

    Hi. How much detail do you need?

    Create RAID device using mdadm.
    Make it an LVM physical volume in order to create partitions on it.
    Copy the contents of your old partitions to it and create a swap partition.
    Change partition refs/UUIDs in fstab.
    Install Grub to the RAID device, setting the boot partition to be the RAID root partition
    ASRock P67 Extreme6, Intel i5 2500K, 8GB RAM, nVidia 6600GT, 4x1TB RAID1+0

  3. #3
    Join Date
    Oct 2008
    Location
    Liverpool, UK
    Beans
    44
    Distro
    Ubuntu

    Re: Single HDD (installed on) -> Dual HDD RAID 1 migration

    A little bit more verbosity such as, how would I go about copying?
    Code:
    sudo cp -R / /mnt/md0
    Or would that not be a wise thing to do?

    What do I change the UUIDs to?
    How do I install GRUB on the RAID array and ensure it boots?

  4. #4
    Join Date
    Oct 2009
    Beans
    2,199
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Single HDD (installed on) -> Dual HDD RAID 1 migration

    There are quite a lot of details involved. I recommend you take it step by step and Google for tutorials such as:
    how to create a RAID1
    how to copy a Ubuntu root partition
    how to re-install grub

    Then come back with specific questions about things that didn't work.
    ASRock P67 Extreme6, Intel i5 2500K, 8GB RAM, nVidia 6600GT, 4x1TB RAID1+0

  5. #5
    Join Date
    Oct 2008
    Location
    Liverpool, UK
    Beans
    44
    Distro
    Ubuntu

    Re: Single HDD (installed on) -> Dual HDD RAID 1 migration

    Quote Originally Posted by YesWeCan View Post
    There are quite a lot of details involved. I recommend you take it step by step and Google for tutorials such as:
    how to create a RAID1
    how to copy a Ubuntu root partition
    how to re-install grub

    Then come back with specific questions about things that didn't work.
    Probably a good set of steps to take. I can always fall back on booting from the original drive if things do go horribly wrong .

  6. #6
    Join Date
    Oct 2008
    Location
    Liverpool, UK
    Beans
    44
    Distro
    Ubuntu

    Re: Single HDD (installed on) -> Dual HDD RAID 1 migration

    I'm not having much luck.

    I tried following (on a virtual machine):
    http://www.howtoforge.com/how-to-set...n-ubuntu-10.04

    While changing it around a bit (in order to accommodate two new HDDs rather than the addition of one).

    But when I reboot I get an error from grub saying it can't find two files.

  7. #7
    Join Date
    Oct 2008
    Location
    Liverpool, UK
    Beans
    44
    Distro
    Ubuntu

    Re: Single HDD (installed on) -> Dual HDD RAID 1 migration

    I believe I've sorted it, seems like the Ubuntu guide is outdated so I followed the debian guide: http://www.howtoforge.com/how-to-set...ian-squeeze-p3

    and it seems to boot from the arrays!

  8. #8
    Join Date
    Oct 2009
    Beans
    2,199
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Single HDD (installed on) -> Dual HDD RAID 1 migration

    Well done!
    ASRock P67 Extreme6, Intel i5 2500K, 8GB RAM, nVidia 6600GT, 4x1TB RAID1+0

  9. #9
    Join Date
    Oct 2008
    Location
    Liverpool, UK
    Beans
    44
    Distro
    Ubuntu

    Re: Single HDD (installed on) -> Dual HDD RAID 1 migration

    This is the exact steps I took for anyone needing them:
    1 (install mdadm and set up kernel modules):
    Code:
    apt-get install mdadm
    modprobe linear
    modprobe multipath
    modprobe raid0
    modprobe raid1
    modprobe raid5
    modprobe raid6
    modprobe raid10
    2 (set up RAID partitions on first drive):
    Code:
    fdisk /dev/sdb
    n, p, 1, default, 31, a
    n, p, 2, default, +2G
    n, p, 3, default, default
    t, 1, fd, t, 2, fd, t, 3, fd
    w
    3 (copy RAID partitions to second drive):
    Code:
    sfdisk -d /dev/sdb | sfdisk --force /dev/sdc
    4 (set up the mdadm devices):
    Code:
    mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sdb1 /dev/sdc1
    mdadm --create /dev/md1 --level=1 --raid-disks=2 /dev/sdb2 /dev/sdc2
    mdadm --create /dev/md2 --level=1 --raid-disks=2 /dev/sdb3 /dev/sdc3
    5 (set up the filesystems):
    Code:
    mkfs.ext4 /dev/md0
    mkswap /dev/md1
    mkfs.ext4 /dev/md2
    6 (set up mdadm auto configure):
    Code:
    mdadm --examine --scan >> /etc/mdadm/mdadm.conf
    7 (mount the mdadm devices):
    Code:
    mkdir /mnt/md0
    mkdir /mnt/md2
    mount /dev/md0 /mnt/md0
    mount /dev/md2 /mnt/md2
    8 (set up fstab):
    Code:
    nano /etc/fstab
    Edit so /, /boot and swap point to the arrays.
    Code:
    /dev/md2	/	ext4		errors=remount-ro	0	1
    /dev/md0	/boot	ext4		defaults		0	2
    /dev/md1	none	swap		sw			0	0
    9 (set up mtab):
    Code:
    nano /etc/mtab
    Edit so that / and /boot point to the arrays.
    Code:
    /dev/md2 / ext4 rw,errors=remount-ro 0 0
    /dev/md0 /boot ext4 rw 0 0
    10 (set up grub2 custom entry):
    Code:
    cp /etc/grub.d/40_custom /etc/grub.d/09_swraid1_setup
    nano /etc/grub.d/09_swraid1_setup
    Add to the bottom:
    Code:
    menuentry 'Ubuntu, with Linux 2.6.38-8-server' --class ubuntu --class gnu-linux --class gnu --class os {
    		recordfail
    		insmod raid
    		insmod mdraid1x
    		insmod ext2
            set root='(md/0)'
            linux   /vmlinuz-2.6.38-8-server root=/dev/md2 ro quiet
            initrd  /initrd.img-2.6.38-8-server
    }
    11 (set up grub2):
    Code:
    nano /etc/default/grub
    Uncomment:
    Code:
    GRUB_DISABLE_LINUX_UUID=true
    12 (update grub2 and initrd):
    Code:
    update-grub
    update-initramfs -u
    13 (copy the data over to the RAID array):
    Code:
    cp -dpRx / /mnt/md2
    cd /boot
    cp -dpRx . /mnt/md0
    14 (install grub2 on the RAID array member disks):
    Code:
    grub-install /dev/sdb
    grub-install /dev/sdc
    15 (booting into the RAID environment):
    Code:
    reboot
    set boot device in BIOS to a RAIDed disk and continue booting.

    15 (remove the grub2 custom entry (no longer needed)):
    Code:
    rm /etc/grub.d/09*
    update-grub
    update-initramfs -u
    16 (ensure grub2 is installed on the RAID array member disks one last time):
    Code:
    grub-install /dev/sdb
    grub-install /dev/sdc
    17 (finish up):
    Code:
    reboot
    Last edited by craigcrawford114; June 19th, 2011 at 04:59 PM.

  10. #10
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    8,373
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Single HDD (installed on) -> Dual HDD RAID 1 migration

    Nice tutorial. Although I would have set up the drives differently:

    For 1 TB drives:

    Drive 1

    20 GB Boot/OS partition
    980 GB RAID1 Data partition

    Drive 2

    20 GB Boot/OS partition (rsync'd once a week or once a month)
    980 GB RAID1 data partition

    By keeping the OS out of the RAID, you have more options for troubleshooting. By rsyncing the Boot/OS partition you have a weekly or monthly snapshot that you can either boot from directly or you can use for comparison and troubleshooting.

    With your current configuration, when the RAID fails, you won't be able to boot; you will have to use a Live CD and not have any of your configuration or services set up.
    Last edited by tgalati4; June 19th, 2011 at 04:07 AM.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •