Lab 11: Lab notes: - Lab 10 successful completion is a prerequisite for this lab - The sda8, sda9 partitions below may change based on current disk partition. See instructor for current # s. - After the labs. The original /home partition is to be restored for subsequent lab. So these labs will be graded in class 1)Freeing up disk space Use fdisk to delete /share /home, Ubuntu partitions, swap (as appropriate). Remove from /etc/fstab: /share, swap, Rerun grub2-mkconfig -o /boot/grub2/grub.cfg Rerun grub2-install /dev/sda (see Internet for current commands) See Lab 11 recovery if necessary for swap space removal. RAID 0 Exercise 2) Create LVM partitions: fdisk -l fdisk /dev/sda n, +10G n, +10G t, 8e t,8e w fdisk -l into single user mode (how?) 3) Create physical volumes: pvcreate /dev/sda8 /dev/sda9 pvremove /dev/sda8 /dev/sda9 pvdisplay /dev/sda8 /dev/sda9 pvcreate /dev/sda8 /dev/sda9 pvdisplay /dev/sda8 /dev/sda9 4) Create volume group vgcreate vg1 /dev/sda8 /dev/sda9 vgdisplay vgscan vgrename vg1 homevol vgdisplay vgremove homevol vgcreate homevol /dev/sda8 /dev/sda9
5) Create logical volume lvcreate --name newhome --size 5G homevol lvscan lvrename homevol newhome home lvremove /dev/homevol/home lvcreate --name home --size 5G homevol lvreduce -L1G /dev/homevol/home 6) Create and restore the filesystem mkfs -t ext3 /dev/homevol/home # ormke2fs j /dev/homevol/home mount /dev/homevol/home /home # Untar the backup to /home update /etc/fstab to point /home to new filesystem on /dev/homevol/home 7) Increase filesystem size vi fstab, restore old /home filesystem, umount /dev/homevol/home tune2fs -O ^has_journal /dev/homevol/home e2fsck -f /dev/homevol/home lvextend L10G /dev/homevol/home resize2fs /dev/homevol/home 10G tune2fs -j /dev/homevol/home mkdir /mnt/hometmp
8) Increase volume group size and filesystem size Add new partition fdisk /dev/sda n, +4G t,8e w? umount /dev/homevol/home pvcreate /dev/sda10 vgextend homevol /dev/sda10 tune2fs -O ^has_journal /dev/homevol/home e2fsck -f /dev/homevol/home lvextend L23G /dev/homevol/home resize2fs /dev/homevol/home 23G tune2fs -j /dev/homevol/home 9) RAID1 Exercise # Delete LV, VG, PV from RAID 0 exercise how? # Change partitions sda8, sda9,to type fd - how? mdadm --create /dev/md0 --level 1 -n 2 /dev/sda8 missing mdadm --manage /dev/md0 --add /dev/sda9 tail -f /proc/mdstat (monitor mirror build process) mkfs -t ext3 /dev/md0 Untar the backup to /mnt/hometmp echo "DEVICE /dev/sda8 /dev/sda9" >> /etc/mdadm.conf mdadm detail scan tee a /etc/mdadm.conf update /etc/fstab 10) Breaking the mirror (Note: make sure the last two commands against mdadm.conf are done) mdadm stop /dev/md0 # To restart and remount the RAID: mdadm assemble /dev/md0
11) Simulate RAID1 drive loss dd if=/dev/zero of=/dev/sda9 bs=1024 count=1024 mdadm detail scan /dev/md0 ls /mnt/hometmp # Re start raid with 1 drive. mdadm --fail /dev/md0 /dev/sda9 mdadm --detail -scan /dev/md0 (monitor mirror build process) # Use FDISK to delete and and redefine /dev/sda9 as type fd how? Recreate /dev/sda9 as fd Reboot mdadm add /dev/md0 /dev/sda9 ls al /mnt/hometmp LVM using RAID1 (bypass this lab for steps 13,14 12) LVM using RAID1 # Use the GUI to remove MD0 mdadm --create /dev/md0 --level 1 -n 2 /dev/sda8 missing mdadm --manage /dev/md0 --add /dev/sda9 tail -f /proc/mdstat (monitor mirror build process) pvcreate /dev/md0 vgcreate homevol /dev/md0 lvcreate --name home --size 10G homevol mke2fs -j /dev/homevol/home # Untar the backup to /mnt/hometmp # update mdadm.conf how? View LVM setup from GUI
Other file system types 13) Mounting /mnt/hometmp as ext4 umount /dev/md0 tune2fs -O extents,uninit_bg,dir_index /dev/md0 e2fsck -pdf /dev/md0 mount -t ext4 /dev/md0 /mnt/hometmp 14) Permanent Ext2 to Ext4 tune2fs j /dev/md0 tune2fs -O extents,uninit_bg,dir_index /dev/md0 e2fsck -fdc0 /dev/md0 15) Replace 10G /home as 40 Gb standalone partition in Ubuntu area (if necessary) 16) Remove disk quotas from /etc/fstab, delete aquota.user. 17) Reboot