Device sdb sdc sdd
1. Will be composed of three hard disk RAID5, the realization of security
2. Md0 array created in the physical volume, volume group, logical volume
3. To be transferred to the logical volume data
Specific steps:
Three 1.fdisk hard drive, partition type fd, finally sdb1, sdc1, sdd1
2. To create raid devices
# mdadm-Cv / dev/md0-l5-n3 / dev / sd [b, c, d] 1
3. # Pvcreate / dev/md0 to initialize the array of physical volumes
4. # Vgcreate vg / dev/md0
5. # Lvcreate-n home-L 100M vg
# lvcreate-n var-L 100M vg
# mkfs.ext3 / dev / vg / home
# mkfs.ext3 / dev / vg / var
# mkdir / mnt / home
# mkdir / mnt / var
# mount / dev / vg / home / mnt / home
# mount / dev / vg / var / mnt / var
# cp-a / home / * / mnt / home
# cp-a / var / * / mnt / var
# df-lh
6. # Vi / etc / fstab to add
/ dev / vg / home / home ext3 defaults 0 0
/ dev / vg / var / var ext3 defaults 0 0
7. # Vi / etc / mdadm.conf create a file so that the system can automatically identify the start-raid device, which reads as follows:
DEVICE / dev/sdb1 / dev/sdc1 / dev/sdd1 ARRAY / dev/md0 level = raid5 num-devices = 3 UUID = 123545: erdfj3: dkf3jd
(UUID specific through mdadm-D / dev/md0 access)
Or # vi / etc / rc.sysinit to modify this file, search raid, it added the following commands: raidstart / dev/md0
8.reboot
The above data has been correctly transferred to LVM, the following will / migrate to LVM on partition
# lvcreate-n root-L 200M vg
# mkfs.ext3 / dev / vg / root
# mount / dev / vg / root / mnt
# cd / mnt
# mkdir proc tmp var home opt cdrom media mnt srv selinux
# cd /
# cp-a bin dev etc lib sbin root usr sys / mnt &
When the course of the operation time is too long, can ctrl + z, and then type bg, it runs in the background
Skills:
# rm-rf / mnt / bin forced to delete the directory
# \ ls not highlighted
RAID5 disk capacity utilization rate of 2 / 3
Use mkinitrd to create a virtual disk image file
# mkdir / boot / test
# mkinitrd-v-preload raid5-preload lvm-m0d / boot/test/initrd-lvm- $ (uname-r) img $ (uname-r)
Add inside the root partition to load the necessary device file raid, driver, such as command mdadm
# cd / boot / test
# mv initrd-lvm-2.6.15-1.2054_FC.img initrd-lvm-2.6.15-1.2054_FC.img.gz
# gunzip init-lvm-2.6.15-1.2054_FC.img.gz
# cpio-idv
Add a device file, copy the files necessary to pay attention to-a parameter
# cp-a / dev / vg dev
# cp-a / dev / mapper dev
# cp-a / dev/md0 dev
# cp-a / dev / sd [abcd] dev
# cp-a / dev / sd [abcd] 1 dev
# vi init add, mkblkders must add, the system after the implementation of the first script, to automatically activate the disk array
mdadm-As
vgscan
vgchange-a y
Modified to load the root partition
mount-o defaults - ro-t ext3 / dev / vg / root / sysroot
# cp / sbin / vgscan bin
# cp / sbin / vgchange bin
# cp / sbin / mdadm bin
# ldd bin / mdadm to view the documents required by the orders of the Treasury
# cp / lib/libc.so.6 lib (letter o) to add the library files required by the orders
# cp / lib/ld-linux.so.1 lib
Mdadm-As the above configuration file based on arrays mdadm.conf activated, so / etc / mdadm.conf copy from
# cp / etc / mdadm.conf etc (manually created before mdadm.conf), add configuration file
Final confirmation / boot / test directory of the documentation package
# cd / boot / test
# find-print | cpio-oc> / boot/initrd-lvm- $ (uname-r). img
# cd / boot
# gzip initrd-lvm-2.6.15-1.2054_FC.img-c> init-lvm-2.6.15-1.2054_FC.img.gz
This will document the restoration of a virtual disk image file
Modify boot configuration
# vi / boot / grub / grub.conf
Modify defaults = 1
Add
title Fedora LVM
root (hd0, 0)
kernel / boot/vmlinuxz-2.6.15-1.2054_FC ro root = / dev / vg / root
And the / boot directory in the corresponding vmlinuxz, pay attention to root = / dev / vg / root changes
initrd / boot/initrd-lvm-2.6.15-1.2054_FC.img.gz
Saved from the
# mount / dev / vg / root / mnt
# cd / mnt
# vi etc / fstab modifications
/ dev / vg / root / ext3 defaults 1 1
This system will be activated / dev / vg / root used as a primary partition
Completed all the modifications
# reboot
After Kai ls / boot should not be, because the physical boot partition in sda1-ri
Can # mount / dev/sda1 / mnt inside look at the contents of the boot
Have successfully proved the transfer of the root partition, the completion of the request made by the case.
In this experiment, the main image file on disk changes, modify init file, it is necessary to pay attention to the order of loaded modules, first create a block device in order to use pieces of paper.
Use mkinitrd to create documents, should pay attention to view the file using the command file type, thus further decompression of image files, extraction and other operations. When the modification after the initrd disk image file, it is necessary to know how to pack, compressed. How to use cpio command attention.
0 评论:
发表评论