===== Replace LVM disk to upgrade capacity ===== This example will copy /dev/sde1 mounted on /backup to /dev/sdf1 mounted on /replace and afterwards change mount point, logical volume and volume group names to the source names. ==== Prepare new disk ==== * fdisk /dev/sdf * **n** to create a new partition, select **1** and accept all defaults * **w** to write the new partition table and quit * mkfs.ext3 /dev/sdf1 * lvm * lvm > pvcreate /dev/sdf1 * lvm > vgcreate vg_replace /dev/sdf1 * lvm > vgdisplay vg_replace to check ### of free extents * lvm > lvcreate -l### vg_replace (do not use -LxxGB, use size with -l### which is number of extents) * lvm > lvrename vg_replace lvol0 lv_replace * lvm > vgcfgbackup to backup volume group configurations * lvm > exit * mkfs -t ext3 /dev/vg_replace/lv_replace * mkdir /replace * mount /dev/vg_replace/lv_replace /replace ==== Copy content and assign new disk ==== * rsync -avH /backup/* /replace/ * umount /backup * umount /replace * lvm * lvm > lvrename vg_backup/lv_backup lv_backup1 * lvm > lvchange vg_backup/lv_backup1 -an * lvm > vgrename vg_backup vg_backup1 * lvm > lvchange vg_backup1/lv_backup1 -ay * lvm > lvrename vg_replace/lv_replace lv_backup * lvm > lvchange vg_replace/lv_backup -an * lvm > vgrename vg_replace vg_backup * lvm > lvchange vg_backup/lv_backup -ay * lvm > exit * mount /dev/vg_backup/lv_backup /backup -o noatime,user_xattr ==== Setting up LVM on top of a Linux Software Raid ==== * prepare the new disks with a partition (see above), do not create the filesystem yet * mdadm --create --verbose /dev/md5 --level=1 --raid-devices=2 /dev/sde /dev/sdf * watch the progress with cat /proc/mdstat * when finished, restart the computer (shutdown -r now)