Solved

Create new linux software raid without losing data ?

Posted on 2013-01-01
6
720 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 77

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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 77

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 77

Expert Comment

by:arnold
ID: 38736976
great.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VirtualBox in Fedora 25 Linux:  Unable to Install OS 11 222
networking details on centos 6.6 4 62
Hacked File Timestamps 4 62
File and print server with Ubuntu? 7 43
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

770 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