FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 06-24-2010, 02:38 AM
Eric Dannewitz
 
Default Creating a RAID 1 from existing drive

I have a Ubuntu server that has one HD in it right now. I just obtained another drive that is exactly the same (manufactor/size/model). Is it possible to mirror the existing drive with this one? If so, how? Do I need to reformat anything?
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 06-24-2010, 05:55 AM
Tom H
 
Default Creating a RAID 1 from existing drive

On Wed, Jun 23, 2010 at 10:38 PM, Eric Dannewitz <ericdano@gmail.com> wrote:
> I have a Ubuntu server that has one HD in it right now. I just obtained
> another drive that is exactly the same (manufactor/size/model). Is it
> possible to mirror the existing drive with this one? If so, how? Do I need
> to reformat anything?

A non-detailed guide (I hope that I won't forget anything!):

(To be adjusted if you want a non-mdadm'd /boot or don't have just one
partition)

Assume that sda1 is swap, sda2 is /, and sdb is the new disk.

Duplicate sda's partitions onto sdb with
sfdisk -d /dev/sda | sfdisk /dev/sdb

Set sdb2 as auto raid with fdisk or parted

Create md0 and md1 with "--raid-devices=1"

Run mkswap and mkfs

Mount md1 and rsync sda1 onto it, excluding directories like /dev,
/lost+found, ...

Create the excluded directories on md1 and chroot into it

Edit fstab to use md0 and md1

Install grub

Exit the chroot and reboot from md1

Grow md0 and md1 and add sda1 and sda2 to them

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 06-24-2010, 03:50 PM
Preston Hagar
 
Default Creating a RAID 1 from existing drive

On Wed, Jun 23, 2010 at 9:38 PM, Eric Dannewitz <ericdano@gmail.com> wrote:
> I have a Ubuntu server that has one HD in it right now. I just obtained
> another drive that is exactly the same (manufactor/size/model). Is it
> possible to mirror the existing drive with this one? If so, how? Do I need
> to reformat anything?
> --


I have used this guide many times with a lot of success:

http://www.tolaris.com/2008/10/01/moving-your-linux-root-partition-to-raid/

It is pretty much your exact situation, moving from a single disk to a
two disk RAID 1 setup. A general overview is you setup a degraded
RAID 1 array on your new disk, copy everything over there, boot to the
new RAID 1 disk, then once everything looks good, make the
old/original disk part of the RAID 1 array.

Preston

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 06-25-2010, 09:00 AM
Tom H
 
Default Creating a RAID 1 from existing drive

On Thu, Jun 24, 2010 at 11:50 AM, Preston Hagar <prestonh@gmail.com> wrote:
> On Wed, Jun 23, 2010 at 9:38 PM, Eric Dannewitz <ericdano@gmail.com> wrote:
>> I have a Ubuntu server that has one HD in it right now. I just obtained
>> another drive that is exactly the same (manufactor/size/model). Is it
>> possible to mirror the existing drive with this one? If so, how? Do I need
>> to reformat anything?
>
> I have used this guide many times with a lot of success:
> http://www.tolaris.com/2008/10/01/moving-your-linux-root-partition-to-raid/

Thanks for the link. I'd forgotten to point out a second "sfdisk
-d..." and an "update-initramfs..." in my email so, even though I
hadn't intended to write a comprehensive howto, I missed two important
steps and I stand corrected.

Regarding the tolaris procedure: It is relatively old (from a Ubuntu
perspective not from a Debian Lenny perspective) so it uses vol_id and
grub1 but that's easily adaptable and it doesn't allow for booting in
degraded mode.

Regarding your email, a small semantic point:

You describe the tolaris procedure as creating a "degraded RAID 1
array" but it isn't quite the case.

Creating a mirror with
mdadm --create /dev/md0 --level=1 --force --raid-devices=1 /dev/sdb1
means that you are creating a raid1 mirror with one sub-mirror (to
borrow from Solaris terminology).

To create a degraded mirror, you would have to run
mdadm --create /dev/md0 --level=2 --raid-devices=2 missing /dev/sdb1
which means that when you add sda1, you would run
mdadm /dev/md0 --add /dev/sda1
rather than
mdadm /dev/md0 --grow --raid-devices=2
mdadm /dev/md0 --add /dev/sda1
as in the "one sub-mirror case".

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 01:06 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org