system transfer to RAID + LVM (short summary)
A little bit about working with soft RAID (mdadm) and LVM, maybe with a lot of free time THIS will turn into some decent article ... but for now, just a bunch of commands with brief comments.
So, once I needed more space for the virtual box folder ... we
create fs on the LVM partition on top of the raid0 array of 3 disks: ========================== =========================== later I decided to transfer to reid0 the whole system from the / dev / sdd drive: # Transferring the system completely to 3 disks in RAID0 (except / boot): # Unmount a partition: # Delete a group of volumes to unlock a read # Stop a read # Delete labels (superblocks) from disks: # Break up the first disk
# Copying the partition table to the remaining disks: # do boot # do swap # collect array # do volume, group with fragment size 64Kb, partitions. # copy data from the old partitions to the new ones: # create a snapshot of the section: # copy data:
So, once I needed more space for the virtual box folder ... we
create fs on the LVM partition on top of the raid0 array of 3 disks: ========================== =========================== later I decided to transfer to reid0 the whole system from the / dev / sdd drive: # Transferring the system completely to 3 disks in RAID0 (except / boot): # Unmount a partition: # Delete a group of volumes to unlock a read # Stop a read # Delete labels (superblocks) from disks: # Break up the first disk
root@ws:~# mdadm -C /dev/md0 -l0 -n3 /dev/sd[abc]
root@ws:~# mdadm --detail --scan >> /etc/mdadm/mdadm.conf
root@ws:~# pvcreate /dev/md0
Physical volume "/dev/md0" successfully created
root@ws:~# vgcreate -s 64K raid0 /dev/md0
Volume group "raid0" successfully created
root@ws:~# lvcreate -n vbox -L200G raid0
Logical volume "vbox" created
root@ws:~# mkfs.ext4 -b 4096 -E stride=16,stripe-width=48 -L vbox /dev/raid0/vbox
umount /dev/raid0/vbox
vgremove raid0
mdadm --manage /dev/md0 --stop
mdadm --zero-superblock /dev/sd[abc]
fdisk /dev/sda
Устр-во Загр Начало Конец Блоки Id Система
/dev/sda1 1 132 1060258+ 83 Linux
/dev/sda2 133 26241 209720542+ fd Автоопределение Linux raid
# Copying the partition table to the remaining disks: # do boot # do swap # collect array # do volume, group with fragment size 64Kb, partitions. # copy data from the old partitions to the new ones: # create a snapshot of the section: # copy data:
sfdisk -d /dev/sda | sfdisk /dev/sdb
sfdisk -d /dev/sda | sfdisk /dev/sdс
mkfs.ext2 -L boot /dev/sda1
mkswap /dev/sdb1
mkswap /dev/sdc1
mdadm -C /dev/md0 -l0 -n 3 /dev/sd[abc]2
pvcreate /dev/md0
vgcreate -s 64K raid0 /dev/md0
lvcreate -n VirtualBox -L100G raid0
lvcreate -n root -L10G raid0
lvcreate -n var -L10G raid0
lvcreate -n usr -L10G raid0
lvcreate -n tmp -L1G raid0
lvcreate -n home -L100G raid0
lvcreate -n media -L100G raid0
lvcreate -s /dev/main/root -n snap_root -L10G
mount /dev/main/snap_root /mnt/tmp/
mount /dev/raid0/root /mnt/target/
cp -a /mnt/tmp/* /mnt/target/
#то же для остальных разделов
#правлю fstab и права доступа
#копирую файлы в /boot; добавляю grub в MBR
#всё. ребут и молимся что ничего не забыли. =)