标签:auto rect tor pos nis work volume under arrays
如果现在有一块硬盘(分区)正在使用,如果要设置成RAID1,并不需要将数据拷出,然后创建RAID1。
可以先将此硬盘设置成降级RAID1,然后添加新硬盘再激活RAID1即可,整个过程数据无损。
参考:
https://debian-administration.org/article/238/Migrating_To_RAID1_Mirror_on_Sarge
Migrating To RAID1 Mirror on Sarge
Posted by philcore on Thu 8 Sep 2005 at 21:03
Tags: filesystems, raid, raid1, sarge
A guide to migrating to RAID1 on a working Debian Sarge installation which was installed on a single drive.
I suggest reading the following links: Migrating to a mirrored raid using Grub, GRUB and RAID mini-HOWTO.
My setup:
/dev/sda == original drive with data
/dev/sdb == new 2nd drive.
(It is assumed that you have RAID1 enabled in your kernel.)
First of all install md tools:
apt-get install mdadm
change the system types on partitions you want to mirror on the old drive to fd (raid autodetect) using [s]fdisk. Don‘t change the swap partition! Your finished drive should resemble this output:
[root@firefoot root]# sfdisk -l /dev/sda
Disk /dev/sda: 8942 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sda1 * 0+ 242 243- 1951866 fd Linux raid autodetect
/dev/sda2 243 485 243 1951897+ fd Linux raid autodetect
/dev/sda3 486 607 122 979965 82 Linux swap / Solaris
/dev/sda4 608 8923 8316 66798270 5 Extended
/dev/sda5 608+ 1823 1216- 9767488+ fd Linux raid autodetect
/dev/sda6 1824+ 4255 2432- 19535008+ fd Linux raid autodetect
/dev/sda7 4256+ 4377 122- 979933+ fd Linux raid autodetect
/dev/sda8 4378+ 8923 4546- 36515713+ fd Linux raid autodetect
Now use sfdisk to duplicate partitions from old drive to new drive:
sfdisk -d /dev/sda | sfdisk /dev/sdb
Now use mdadm to create the raid arrays. We mark the first drive (sda) as "missing" so it doesn‘t wipe out our existing data:
mdadm --create /dev/md0 --level 1 --raid-devices=2 missing /dev/sdb1
Repeat for the remaining raid volumes md1,md2, etc....
mdadm --create /dev/md1 --level 1 --raid-devices=2 missing /dev/sdb2
Now that the volumes are ready create filesystems for the raid devices. My example shows using ext3, but pick the filesystem of your choice. Again, make sure you have kernel support for your selected filesystem.
mkfs.ext3 /dev/md0
mkfs.ext3 /dev/md1
etc...
Now mount the new raid volumes. I mount them under the /mnt directory:
mount /dev/md0 /mnt
cp -dpRx / /mnt
标签:auto rect tor pos nis work volume under arrays
原文地址:https://www.cnblogs.com/felix-zp/p/9742056.html