RAID1+LVM安装

  • sudo mdadm -E /dev/sda5 

  • sudo mdadm -Av /dev/md0 --uuid=47b7dc92:0dd53670:01d7672c:70b7c4cb /dev/sda5 /dev/sdb5

  • mdadm -Ds >> /etc/mdadm/mdadm.conf

  • update-initramfs -u


  • sudo apt-get install lvm2 mdadm

  • mdadm --create /dev/mdx --level=1 --raid-devices=2 /dev/sdax missing

  • vgcreate vg0 /dev/mdx --physicalextentsize 32M

  • sudo lvcreate -L100G -n qihua vg0


  • sudo update-initramfs -u   #Make it loaded by ram fs.

  • sudo mdadm --zero-superblock /dev/sda[x]


   

  • sudo mkfs.ext4 -m0 /dev/vg0/qihua

  • sudo mkfs.ext4 -m0 /dev/vg0/akhome



sudo mkdir /media/lvm

sudo mount /dev/mapper/vg0-akhome /media/lvm/

sync to temp directory.

sudo rsync -av --exclude=lost+found           --exclude='/media/*'           --exclude='/dev/.[isu]*'           --exclude='/lib/init/rw/*'           --exclude='/lib/modules/*/volatile/*'           --exclude='/proc/*'           --exclude='/sys/*'           --exclude='/home/*'           --exclude='/var/lock/*'           --exclude='/var/run/*'     / /media/lvm/


rsync -av --exclude=lost+found --exclude=/media/* --exclude='/dev/.[isu]*' --exclude='/lib/init/rw/*' --exclude='/lib/modules/*/volatile/*' --exclude='/proc/*' --exclude='/sys/*' --exclude='/home/*' --exclude='/var/lock/*' --exclude='/var/run/*' / /media/lvm/

sudo cp /proc/cmdline /media/lvm/proc/

sudo cp /proc/modules /media/lvm/proc/

sudo chmod a+w /media/lvm/proc/cmdline,

sudo vi /media/lvm/proc/cmdline change: root=/dev/mapper/vgx-xxxxxx ro

sudo chmod a+w /media/lvm/etc/fstab

sudo vi /media/lvm/etc/fstab

sudo chmod a+w /media/lvm/boot/grub/grub.cfg

sudo vi /media/lvm/boot/grub/grub.cfg


sudo chroot /media/lvm

update-initramfs -c -k `uname -r`

sudo grub-install --root-directory=/media/lvm /dev/sdx

你可能感兴趣的:(安装,create,loaded)