Exercise 3
Table of Contents
1 Exercise 3
This is the third exercise of the course. In this exercise you will learn about LVM and upgrading a system. You will also get more familiar with the practical things that come along with them.
New! Clarifications, and a help chapter for dealing with full partitions.
1.1 Deadlines
- Finish exercises 2 and 3 by the end of Sunday the 3nd of February. If you think you cannot make it, send email to the instructors and we'll figure something out. The exercises will be evaluated soon after the deadline and instructions about possible corrections and time to fix them are given.
1.2 Exercise 3 is passed, if:
- VM is running, allows login, is up to date, has its images in ~, has the appropriate log.
- LVM is being used.
- Partitions are the specified size.
- TUNNUS1.ties478.website vhost is setup.
1.3 Homework
- Estimate the impact of diskfiller.sh in your new KONE1 compared
to the old one. Analyze the differences in your log. (You can run
yes > /tmp/biggg
to fill up /tmp. That's basically what the diskfiller.sh did.)
2 Steps
2.1 Reinstall KONE1 with LVM, restore homes and lighttpd-settings
2.1.1 Installation
- Shutdown KONE1 if it's still running. Backup the old image. Clean up even older backups and images you don't need anymore.
- Make a 5GB disk image in ramdisk. Start the installer for new KONE1. You may use console or graphical installer. Try "Expert mode" (F6). Use similiar settings as previously, except for the following:
- Disk setup: Choose manual partitioning. Allocate whole disk as
primary partition, with LVM as its use. Choose to configure LVM.
Create TUNNUS1-vg and logical volumes:
Partition Size Filesystem Mount point lvroot 700M ext4 / lvusr 900M ext4* /usr lvvar 700M ext4 /var lvtmp 100M ext2 /tmp lvhome 1G ext4 /home lvswap1 1G swap —
2.1.2 Post-installation
- Setup Kerberos and users.
- (Optional) Enable serial console.
- Attach KONE1's backup for the next steps. (
virsh attach-disk ... --driver qemu --subdriver qcow2
) - Restore home directories.
2.1.3 Restore lighttpd-settings
- Copy old configuration from the backup. Confirm that everything is working as usual.
- (Optional) Change configuration so that each vhost is it in its
own configuration file in
conf-available
folder. Check that you can enable and disable them separately withlighty-enable-mod
andlighty-disable-mod
commands. - Setup TUNNUS1.ties478.website vhost with its own configuration file. Serve an index file that contains (at least) the string "tarzan".
2.2 Upgrade Ubuntu
- Detach and remove any old backups we don't need anymore.
- Make a backup of the current system.
- Extend partitions. If necessary, create a new 1GB volume and
attach it to the VM, extending the partitions further with it.
Useful commands:
lvresize, pvcreate, qemu-img
. do-release-upgrade
!- If something goes wrong, restore the backup and start over. If the upgrade falls apart halfway through, it's faster to start over than to try to force it through.
2.3 If partitions get full
- Chech the status of filesystems with
df
(also for inodes with-i
) - If lvroot or lvusr are full, it might be the kernel. If there are two or more kernels installed, they might not fit (especially the generic variant).
- To list installed kernels, you can use
dpkg -l | grep linux
- If there is a failed install or upgrade,
apt
might not allow any operations until inconsistencies are fixed (i.e. all packages to install are installed successfully) – you can fix this withapt install --fix-broken
whichapt
might suggest itself. - You can forcefully remove packages with
dpkg --purge --force-breaks packages
. This is very dangerous and you shouldn't reboot until you have a kernel properly installed. The command might give you enough space to reinstall and reconfigugre packages with the--fix-broken
command above. If things get worse, then it's better to just restore from a backup.
2.4 Finish
- Drop the amount of RAM to 256MB (
virsh edit KONE1
, 262144). - Check disk space.
- Check the exercise.
- Remember homework!