LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Existing LVM filesystem to software RAID 0 (mirroring) (https://www.linuxquestions.org/questions/linux-server-73/existing-lvm-filesystem-to-software-raid-0-mirroring-623743/)

hellowe 02-25-2008 12:10 PM

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

rupertwh 02-25-2008 12:35 PM

Quote:

Originally Posted by hellowe (Post 3069309)
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.

Deleriux 02-25-2008 01:30 PM

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.

hellowe 02-25-2008 10:39 PM

Quote:

Originally Posted by Deleriux (Post 3069402)
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

Deleriux 02-26-2008 06:16 AM

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.

hellowe 02-26-2008 09:00 AM

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

Deleriux 02-26-2008 10:22 AM

/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.

hellowe 04-22-2008 12:23 PM

Quote:

Originally Posted by Deleriux (Post 3069402)
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,

alder 11-25-2009 07:28 AM

vgextend leads to kernel panic at boot
 
Quote:

Originally Posted by hellowe (Post 3129294)
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


All times are GMT -5. The time now is 05:44 PM.