Skip to main content

Posts

Showing posts from November, 2019

Fedora Upgrade with LVM Snapshots

Fedora 31 has been released at the end of October 2019 so it's time for me to update. Fedora Updates have proven to be reliable but Updates can go wrong and for that case, I want to have a fallback that I can utilize to restore my system without much of a hassle. I use LVM for all my Storage so the solution for me was fairly easy: LVM Snapshots. I'm using one volume group for the system named 'vg_base'. If you are copy-pasting the commands, this is the one parameter you'll have to adjust. Without further ado, let's get through the upgrade scenario. While these commands can be executed as user with sudo privileges, I find it easier to do these as root. Install the system-upgrade plugin [root@castle-bravo ~]# dnf -y install dnf-plugin-system-upgrade Now create the snapshots of all the system lvs. Note that you would only need to snapshot the rpmdb as well as the logical volumes containing /etc/, /bin, /sbin, /usr/bin and /usr/sbin but to be on th...

Consistent Backups using LVM Snapshots

Making consistent Backups is key to successful disaster recovery. I've found LVM and its snapshot functionality very helpful in that regard. So I'll cover how to create a snapshot and back it up in a consistent state and restore reliably. First things first, you'll need to have some free space in your volume group, I'll be demonstrating this in a virtual machine. First up, let's start by creating a snapshot of a volume: [archy@server ~]$ sudo lvmcreate -s -n lv_home_$(date +%Y%m%d) -L 10G /dev/vg_base/lv_home This will create a snapshot with 10G COW Space which will fill up once you are writing to the lvm you've specified above. In my case, it's the '/home' mount point on the system and I'm assuming that while the backup is running, I won't write 10G of data. Keep in mind that it is possible to create automatic extending snapshots using the lvm.conf but I will not cover that here. With the snapshot created we can now mount it ...