I want to move my home mailserver from a single hard drive to a mirrored RAID LVM setup on larger hard drives. So a simple cp -a won’t quite do the job.
First off, some useful URLs:
- http://www.gentoo.org/doc/en/lvm2.xml
- http://www.linux.org/docs/ldp/howto/LVM-HOWTO/
- http://gentoo-wiki.com/HOWTO_LVM
- http://gentoo-wiki.com/HOWTO_Migrate_To_RAID
- http://www.midhgard.it/docs/lvm/html/index.html
- http://www.linuxsa.org.au/mailing-list/2003-07/1270.html
First on the list of tasks is to update my kernel with LVM and RAID support built in. Since my current kernel was built a newer version has been released so:
make oldconfig
make menuconfig
make && make modules_install
and modifying the grub configuration will get me where I want to be. You may need to reboot into your new Kernel at this point. I had previously configured LVM and RAID support in my current Kernel so I could proceed without a reboot to install the LVM2 and RAID tools:
emerge lvm2 mdadm
Now time to shutdown the PC, install the new harddrive and power it back on. I want two software RAID partitions, which I setup using fdisk and then created:
mdadm -C /dev/md0 -l 1 -n 2 missing /dev/hdd1 #boot
mdadm -C /dev/md1 -l 1 -n 2 missing /dev/hdd2 #LVM
Then create the LVM on top of hdd2:
pvcreate /dev/md1
vgcreate vg /dev/md1
lvcreate -L1G -nswap vg
lvcreate -L10G -nroot vg
lvcreate -L10G -nvar vg
lvcreate -L20G -nhome vg
lvcreate -L50G -nopt vg
Format and mount the new filesystems:
mkswap /dev/vg/swap
yes | mkfs.reiserfs /dev/vg/root
yes | mkfs.reiserfs /dev/vg/home
yes | mkfs.reiserfs /dev/vg/var
yes | mkfs.reiserfs /dev/vg/opt
mkdir /mnt/gentoo
mount /dev/vg/root /mnt/gentoo
mkdir /mnt/gentoo/home
mount /dev/vg/home /mnt/gentoo/home
mkdir /mnt/gentoo/opt
mount /dev/vg/opt /mnt/gentoo/opt
mkdir /mnt/gentoo/var
mount /dev/vg/var /mnt/gentoo/var
mdadm -C /dev/md1 -l 1 -n 2 missing /dev/hdd1
mkfs.ext2 /dev/md1
mkdir /mnt/new/boot
Here comes the long process. Time to go into single user mode and copy all my files across:
init 1
rsync -avH --progress / /mnt/new
Post new comment