Linode OS Upgrade via /var partition reuse

I have a separate /var partition for my data, and all of my user-generated stuff (Sandstorm, email, databases for things) lives there.

  • Make a new OS image. I was going from 16.04 to 18.04.
  • Make a new boot profile for the image. Include the new OS image and /var.
  • Boot into single user mode.
  • Mount the old /var on /mnt
  • Move /mnt/var/lib/dpkg somewhere else
  • cp /var/lib/dpkg /mnt/var/lib/dpkg
  • Edit /etc/fstab to mount /var on boot.
  • Reboot
  • Docker container should theoretically come right back up once Docker is reinstalled.
  • I have Sandstorm installed on /var/sandstorm
    • Move /var/standstorm to /var/sandstorm-old
    • Reinstall Sandstorm, then stop it
    • Move /var/sandstorm/var away
    • cp -av /var/sandstorm-old/var /var/sandstorm
    • Restart Sandstorm