The perfect installation
Install Mint into a handy logical volume in just a click, then up your LVM-FU by adding a new volume from the command line.
the Mint installer is one of the most straightforward out there. Just accepting the defaults will get you a nice dual-boot arrangement (if you have another operating system installed), or a simple two-partition (EFI and root) setup if there’s nothing installed, or if you want rid of whatever was installed. This suits most people, but we’re not most people, so we’ll do something else.
For one thing, we’ll be ticking that LVM box, and for another we’ll set up a separate /home partition. Neither of these acts will make our install look or act any different, but the first will afford us some flexibility further down the line, when we might want to try another distribution such as Arch, and the second will make our lives a little easier in the unlikely event that our Mint partition dies. One slight annoyance is that we can either set up LVM a separate /home from the comfort of the installer – not both. But we can use this to our advantage, and possibly yours, by demonstrating how to segregate your home directory after the fact. Unfortunately, it’s not possible from the installer to use LVM if other partitions (from other Oses, say) are present, so we’ll presume you’re giving a whole disk to Mint 19.2.
We’ll make a new logical volume for /home in the volume group created for us by the installer, but this trick also works if /home is mounted on a regular partition – which could be on another drive. If you have no idea what any of that means, feel free to skip over the page to explore your new installation. First we need to make room in our volume group. These instructions will only work if the root filesystem – which we’re about to shrink – is unmounted, so we’re assuming you’ve completed your install and are still in the Live environment, or have returned to it.
Let’s say we want to shrink our root partition by 10GB; we can do this with the following command:
$ sudo lvresize mint-vg/root -L-10GB -r
The -r option demands that the filesystem is resized as well. This is important, because if you don’t shrink the filesystem before shrinking the partition, data may get lost. The Mint installer also sets up a swap partition, which you may not need – swap files are considered more flexible. If you want you can delete this partition,
giving more space to home, with
$ sudo swapoff -a
$ sudo lvremove mint-vg-swap_1
Next we create a new logical volume named home
using the space we just freed up, and put a filesystem on it. Note that the first switch is a lower-case L.
$ sudo lvcreate -l 100%FREE -n home mint-vg
$ sudo mkfs.ext4 /dev/mint-vg/home
Now we need to mount the root filesystem of our new install, so that we can update the /etc/fstab file which tells Linux where to find filesystems and mount them on boot.
$ mount /dev/mint-vg/root /mnt
$ sudo nano /mnt/etc/fstab
Add the following line, and delete (Ctrl+k) the one referencing the swap partition if you deleted it earlier: /dev/mapper/mint--vg-home /home ext4 defaults 0 1
Make sure to use the double-dash in mint--vg when we use the /dev/mapper/* nodes; terrible things happen if there are mistakes in this file, but you can fix them by booting with the Live CD and re-editing it. Save it with Ctrl+x then Y, and confirm the filename by pressing Return. Now the important part: mounting the new /home and copying the home directory the installer created for us to it with the correct permissions. This command will work if you’re doing this for an existing install with multiple home directories, too. We cater to all clientele round here.
$ sudo cp -pr /mnt/home/* /mnt/oldhome
$ sudo mount /dev/mapper/mint--vg-home /mnt/ home
$ sudo cp -pr /mnt/oldhome/* /mnt/home
That’s it – you can now reboot and enjoy the luxury of an LVM install. The main advantage of this is flexibility: it’s straightforward to add new storage and grow logical volumes onto them, and it’s straightforward enough (from a Live CD) to shuffle space around between logical volumes. If you’re feeling brave you can incorporate other Linux distributions into your volume group. Once you’ve created a logical volume for your new favourite distro, it should show up as a drive in whatever installer you’re using – and if you’re installing Arch, this is the least of your problems. LVM can handle RAID (see feature Lxf252), but we’ve got other important business to be getting on with.
Upgrading from previous mints
If you already have Mint 19.1 installed then updating to 19.2 is very straightforward. In all likelihood, unless you haven’t taken your Mint installation online for a while you’ve probably already been offered the update. If not, then head to the Update Manager (either from the Administration menu or the shield icon in the system tray) and apply any pending updates. Once they’re done, you should have an option in the Edit menu to Upgrade to Mint 19.2 Tina. Click this, then read excitedly through the release notes and new features. Click the box to agree to the terms of the update (or don’t tick it and don’t update if you don’t agree that sometimes updates will break things), hit Apply and then enter your password to commence the upgrade.
You may be asked whether you want to keep some configuration files or replace them with the new defaults. Unless you’ve specifically edited one of these, you should go for the new version. If you’re not sure, there’s an option to view the differences which may jog your memory. Lines from the new file are prefixed with
+ , and the old with - . All going well, you should see a message with a smiley face telling you to reboot. Do that, and then commence exploring the latest update. If you’re running Mint 19 then you can upgrade in this way first to 19.1 and then to 19.2.
the joys of Lvm “If you’re feeling brave you can incorporate other Linux distributions into your volume group.”