Solved

Create new linux software raid without losing data ?

Posted on 2013-01-01
6
713 Views
Last Modified: 2013-02-14
Hi,

I would like to request an assistant.

I have new pair additional drives (With ready Data) and i wish to mirror both of the drive .

May i know whether the following command is safe without losing my data ?

mdadm --create /dev/md4 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdd1

For your information i have other running raid device on the server and i would like to add the new /dev/md4 .

Appreciates experts comment whether the above command will works without losing the data inside /dev/sdd1 .

Thank you
0
Comment
Question by:smksa
  • 3
  • 2
6 Comments
 
LVL 76

Expert Comment

by:arnold
ID: 38734820
You can not use the existing device /dev/sdd1 as the basis for a new one.

You can use an unused space/partition to create a new raid volume.


Your best bet is to use an unallocated/unused space to create a new md device. Then copy the data into it. You can the remove one member and replacing it with another.

Do you use lvm overlay of raid?i.e. you create /dev/mdi and then use pvcreate /dev/mdi then use vgcreate, lvcreate?

If you can provide what disks you have that are currently unused and the space breakdown of the data as well as what is the total size of the of the raid volume you want.
0
 
LVL 19

Expert Comment

by:jools
ID: 38734862
Before you do anything make sure you have a backup.
0
 
LVL 2

Author Comment

by:smksa
ID: 38735899
Hi,

Actually i already have the following in the current server :

Hard Drive (2 units) (Raid 1)
================

/dev/sda
/dev/sdb

Both of the drive is array for :

/dev/md0
/dev/md1
/dev/md2
/dev/md3

I also have a backup drive :
=====================


/dev/sdc

It is not mounted as a raid array as its only mounted as /backup folder


I wanted to add 2 more drive . 1 unit with data inside, and the other 1 is empty.

So when i plugged in the drive with data it will be detected as /dev/sdd1 and /dev/sde .

I wanted to add into array the new drive with data.

So my question is that whether the data will be wipe off or not after running the following command :

mdadm --create /dev/md4 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdd1

I hope this additional info will helps.

Appreciates your assistant.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 76

Accepted Solution

by:
arnold earned 500 total points
ID: 38736816
You have two drives, one with data /dev/sdd and one empty.
Use the /dev/sde to create the raid volume. Copy the data onto this RAID volume from /dev/sdd1

i.e.
fdisk /dev/sde
partition /dev/sde with two partitions of equal size or just one partition
mdadm --create /dev/md4 --level=1 --raid-devices=2 missing /dev/sde1

mkfs.ftype /dev/md4 if using raw partitions
if using LVM overlay on raid
http://www.thegeekstuff.com/2010/08/how-to-create-lvm/
pvcreate /dev/md4
vgcreate VolGroupxx /dev/md4
lvcreate
vgcreate -L size -n "name of logical volume" VolGroupxx

mkfs.ftype /dev/VolGroupxx/<name of logical volume"
mkfs.ftype /dev/mapper/VolGroupxx-<name of logical volume>

mkdir -p /mnt/src /mnt/dst
mount /dev/sdd1 /mnt/src
mount /dev/mapper/VolGroupxx-<name of logical volume> /mnt/dst
cd /mnt/src
find .  -print  | cpio -pdvmu /mnt/dst
once the data is copied and verified.
you can repartition /dev/sdd
http://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array
and use mdadm --detail /dev/md4
mdadm --manage /dev/md4 --add /dev/sdd1

If you use raw partition, it might be possible to create the array using existing partition without loosing data as you have listed, but I tend to use the two step process to avoid issues.
Make sure you have a backup of the data and then go ahead and try it. you would not need to create a file system as it already exists.
0
 
LVL 2

Author Comment

by:smksa
ID: 38736913
Hi,

Since i had a backup , i have gone ahead and run the command as follows :

[root@vps1 ~]# mdadm --create /dev/md4 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdd1
mdadm: /dev/sdd1 appears to contain an ext2fs file system
    size=976760000K  mtime=Mon Dec 31 00:02:37 2012
Continue creating array? y
mdadm: array /dev/md4 started.
[root@vps1 ~]#


After that i mount the /dev/md4 and all the data is intact.
0
 
LVL 76

Expert Comment

by:arnold
ID: 38736976
great.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to clone Linux server? 15 64
Ubuntu/Asterisk after upgrade Wav issue 19 35
linux crontab output 3 39
PC upgrade to Linux Mint 7 35
This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now