LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-25-2008, 12:10 PM   #1
hellowe
LQ Newbie
 
Registered: Feb 2008
Posts: 4

Rep: Reputation: 0
Existing LVM filesystem to software RAID 0 (mirroring)


Hi there,

I am using FC6 with LVM for a while, and would like to use a software RAID 0(mirroring) with LVM to protect my disk. Could anyone suggest how to proceed for this changes?

Existing my df config. is as below:

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-vg00 229G 17G 202G 8% /
/dev/hda1 190M 46M 135M 26% /boot
none 474M 0 474M 0% /dev/shm

Thx
 
Old 02-25-2008, 12:35 PM   #2
rupertwh
Member
 
Registered: Sep 2006
Location: Munich, Germany
Distribution: Debian / Ubuntu
Posts: 297

Rep: Reputation: 49
Quote:
Originally Posted by hellowe View Post
I am using FC6 with LVM for a while, and would like to use a software RAID 0(mirroring) with LVM to protect my disk.
Firt of all, it's RAID 1. (RAID 0 is striping and won't give any redundancy).

Are you adding a new disk or are both disks already in use? If you are adding a new disk for the raid array, conversion on-the-fly is almost easy. Otherwise, it depends.

You might want to post the output of
Code:
fdisk -l
to give us an overview of your disks.
 
Old 02-25-2008, 01:30 PM   #3
Deleriux
Member
 
Registered: Nov 2003
Posts: 89

Rep: Reputation: 17
The new mirror you create must equal the size of your current LVM volume size.

Assuming VolGroup00 is your volume group.
Assuming /dev/sda is a 1 disk volume group part of your LVM.
Assuming /dev/sdb is your new disk your going to use as your mirror.

Code:
mdadm -C /dev/md0 -l 1 -n 2 /dev/sdb missing
pvcreate /dev/md0
vgextend VolGroup00 /dev/md0
pvmove -v /dev/sda /dev/md0 # verbose is nicer here as it takes forever

vgreduce VolGroup00 /dev/sda
pvremove /dev/sda

mdadm /dev/md0 --add /dev/sda
mdadm --examine --scan > /dev/mdadm.conf
That should do it . Back up your data first. Assume no liability - etc.
 
Old 02-25-2008, 10:39 PM   #4
hellowe
LQ Newbie
 
Registered: Feb 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Deleriux View Post
The new mirror you create must equal the size of your current LVM volume size.

Assuming VolGroup00 is your volume group.
Assuming /dev/sda is a 1 disk volume group part of your LVM.
Assuming /dev/sdb is your new disk your going to use as your mirror.

Code:
mdadm -C /dev/md0 -l 1 -n 2 /dev/sdb missing
pvcreate /dev/md0
vgextend VolGroup00 /dev/md0
pvmove -v /dev/sda /dev/md0 # verbose is nicer here as it takes forever

vgreduce VolGroup00 /dev/sda
pvremove /dev/sda

mdadm /dev/md0 --add /dev/sda
mdadm --examine --scan > /dev/mdadm.conf
That should do it . Back up your data first. Assume no liability - etc.
Thanks to all for the suggestion.

Actually, I only have a IDE disk at my server, and would like to have some questions to ask:

1. If I install a new disk, does it need to be the same(model, capacity) to the existing one for RAID 1 support?
2. For the data backup, can anyone suggest or point to me how to do for this setup? I try to use Ghost 8.3 for disk cloning, but, it seem it cannot support on LVM partition.

Millions thanks to all!!!

thx
 
Old 02-26-2008, 06:16 AM   #5
Deleriux
Member
 
Registered: Nov 2003
Posts: 89

Rep: Reputation: 17
1. No, the second mirrored disk must be equal or larger in capacity than your previous disk. They dont need to be the same model (on linux they dont even need to be using the same disk protocol). One could be IDE, one could be iSCSI. Providing the disk is equal or greater than your current setup thats all that would matter.

2. Use tar.
Since in unix everything is a file you can normally get away with a file by file backup routine - At recovery time you can reformat to ext3 / reiser, recover your data back onto your partition, add the pseudo directories (dev, sys, prc).

Finally just grub-install onto the disk again and your raring to go from where you left off.

Last edited by Deleriux; 02-26-2008 at 06:17 AM.
 
Old 02-26-2008, 09:00 AM   #6
hellowe
LQ Newbie
 
Registered: Feb 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for your valuable advice.

Apart the LVM filesystem, I also have another /boot and /dev/shm filesystems. How can I use the RAID 1 to protect it as well?

Code:
Filesystem             Size   Used  Avail Use% Mounted on
/dev/mapper/rootvg-vg00
                       246G    18G   216G   8% /
/dev/hda1              200M    48M   142M  26% /boot
none                   497M      0   497M   0% /dev/shm
Thanks
 
Old 02-26-2008, 10:22 AM   #7
Deleriux
Member
 
Registered: Nov 2003
Posts: 89

Rep: Reputation: 17
/dev/shm is temporary - its not necessary to raid it.


To do boot

assuming /dev/hda1 is your existing boot partition data
assuming /dev/hdb1 is your mirrored disk
Code:
mdadm -C -l 1 -n 2 /dev/md1 missing /dev/hdb1
cp -aR /boot/* /tmp/location
mdadm --add /dev/md0 /dev/hda1
grub-install /dev/hda
grub-install /dev/hdb
mkfs.ext3 /dev/md1
umount /boot
mount /dev/md1 /boot
cp -aR /tmp/location/* /boot

fdisk /dev/hda #(need to toggle bootable flag on the partition that contains /boot
fdisk /dev/hdb #(need to toggle bootable flag on the partition that contains /boot mirror
Change /etc/fstab to use /dev/md1 as /boot instead of /dev/hda1 (this may involve using e2label to relabel md1 on newer redhats).

Reboot.

Pray.

Assuming no liability again etc.
 
Old 04-22-2008, 12:23 PM   #8
hellowe
LQ Newbie
 
Registered: Feb 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Exclamation

Quote:
Originally Posted by Deleriux View Post
The new mirror you create must equal the size of your current LVM volume size.

Assuming VolGroup00 is your volume group.
Assuming /dev/sda is a 1 disk volume group part of your LVM.
Assuming /dev/sdb is your new disk your going to use as your mirror.

Code:
mdadm -C /dev/md0 -l 1 -n 2 /dev/sdb missing
pvcreate /dev/md0
vgextend VolGroup00 /dev/md0
pvmove -v /dev/sda /dev/md0 # verbose is nicer here as it takes forever

vgreduce VolGroup00 /dev/sda
pvremove /dev/sda

mdadm /dev/md0 --add /dev/sda
mdadm --examine --scan > /dev/mdadm.conf
That should do it . Back up your data first. Assume no liability - etc.
Today, I just have time to setup the RAID1 in my Linux. I have connected a 250G SATA disk and follow the instruction for doing the RAID on my LVM only.

The info. is as below:
1. VG name: rootvg
2. original disk volume group: /dev/hda2
3. new disk volume group: /dev/sda2

It seem all the steps have been finished without any error, and it seem the Linux functions are ok.

Thus, when I try to restart my Linux box, it seem it cannot find the new LVM partition at the boot time.
Code:
Logging initialised at Wed Apr 23 00:57:01 2008
Set umask to 0077
Using volume group(s) on command line
Finding volume group "rootvg"
Wiping cache of LVM-capable devices
Volume group "rootvg" not found
Wiping internal VG cache
Trying to resume from /dev/rootvg/swap00
Unable to access resume device (/dev/rootvg/swap00)
Creating root device.
Mounting root filesystem.
mount: could not find filesystems '/dev/root'
Setting up other filesystems.
Setting up new root fs
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
Could anyone suggest how to recover this issue?

Million thanks,
 
Old 11-25-2009, 07:28 AM   #9
alder
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
Red face vgextend leads to kernel panic at boot

Quote:
Originally Posted by hellowe View Post
Today, I just have time to setup the RAID1 in my Linux. I have connected a 250G SATA disk and follow the instruction for doing the RAID on my LVM only.

The info. is as below:
1. VG name: rootvg
2. original disk volume group: /dev/hda2
3. new disk volume group: /dev/sda2

It seem all the steps have been finished without any error, and it seem the Linux functions are ok.

Thus, when I try to restart my Linux box, it seem it cannot find the new LVM partition at the boot time.
Code:
Logging initialised at Wed Apr 23 00:57:01 2008
Set umask to 0077
Using volume group(s) on command line
Finding volume group "rootvg"
Wiping cache of LVM-capable devices
Volume group "rootvg" not found
Wiping internal VG cache
Trying to resume from /dev/rootvg/swap00
Unable to access resume device (/dev/rootvg/swap00)
Creating root device.
Mounting root filesystem.
mount: could not find filesystems '/dev/root'
Setting up other filesystems.
Setting up new root fs
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
Could anyone suggest how to recover this issue?

Million thanks,
Exactly the same for me (mandriva 2009.1); but it doesn't happen if I extend the volume group with a physical disk or partition, only with raid devices.
Probably it is necessary to perform "vgcfgbackup" after vgextend; I haven't yet tried.
Let's make a deal: the first of us who finds the solution is requested to inform the other one, OK!
Alder
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create software raid on existing /? Micro420 Linux - General 2 11-29-2007 02:19 AM
software raid 5 + LVM and other raid questions slackman Slackware 5 05-09-2007 02:58 PM
Software RAID on an existing system endfx Linux - General 3 12-18-2006 01:05 PM
RHEL 3: Steps of expanding file system (add new SCSI disks) to existing SW RAID & LVM atman1974 Linux - General 2 01-12-2006 09:49 PM
RAID/LVM setup with existing drives juu801 Linux - General 3 07-06-2005 12:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration