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

  1. Shutdown KONE1 if it's still running. Backup the old image. Clean up even older backups and images you don't need anymore.
  2. 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:
  3. 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:
    PartitionSizeFilesystemMount point
    *For lvusr, choose "news" as the typical usage. This will reserve a larger number of inodes for this filesystem.

2.1.2 Post-installation

  1. Setup Kerberos and users.
  2. (Optional) Enable serial console.
  3. Attach KONE1's backup for the next steps. (virsh attach-disk ... --driver qemu --subdriver qcow2)
  4. Restore home directories.

2.1.3 Restore lighttpd-settings

  1. Copy old configuration from the backup. Confirm that everything is working as usual.
  2. (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 with lighty-enable-mod and lighty-disable-mod commands.
  3. 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

  1. Detach and remove any old backups we don't need anymore.
  2. Make a backup of the current system.
  3. 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.
  4. do-release-upgrade!
  5. 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

  1. Chech the status of filesystems with df (also for inodes with -i)
  2. 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).
  3. To list installed kernels, you can use dpkg -l | grep linux
  4. 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 with apt install --fix-broken which apt might suggest itself.
  5. 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!

Date: 2019-03-08T13:32+0200

Author: Janne Uusitupa

Org version 7.9.3f with Emacs version 24

Validate XHTML 1.0