Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Create new linux software raid without losing data ?

Posted on 2013-01-01
6
Medium Priority
?
743 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 79

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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 79

Accepted Solution

by:
arnold earned 2000 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 79

Expert Comment

by:arnold
ID: 38736976
great.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
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…
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.
Suggested Courses

722 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