0

I have an Ubuntu laptop I use as a plex server, seedbox, DNS cache and ad filter for my home network. Since it's the only computer in the house that doesn't get shutdown, I have a tendency to load random stuff onto it just to have a play. This results in it needing to be formatted and reinstalled every now and then (because sometimes I manage to break things pretty damn bad).

I'd like to be able to keep my customised stuff somewhere (I have three external drives attached to the laptop) so that I can format the laptop's internal drive and reinstall Ubuntu, and then just run a script or mount a directory to have the things I want to reappear.

If I could simply store the config files for Transmission, Apache2 and Plex (etc) on an external drive and overlay them on the appropriate directories, that'd be perfect. I've looked at overlayfs but I'm not sure if that's the best solution because I don't want to overlay an entire filesystem (any apt-get upgrades would be stored on the external drive, right?), and I'd like to be able to browse the config files on my external drive without having to mount a squashfs or something.

Braiam
  • 67,791
  • 32
  • 179
  • 269
YodaDaCoda
  • 1,555

2 Answers2

1

I suggest you run LXC - containers. Within a few minutes, you can create a new "virtual machine" (not entirely virtual, but virtual enough for this sort of thing). You can install all your testy stuff inside this container, it behaves like it's another computer. Then, later, you can delete the container, and it won't have any effect on anything else. You can make as many containers as you like, with very little overhead.

Check out https://help.ubuntu.com/lts/serverguide/lxc.html for more about Linux Containers.

AMADANON Inc.
  • 469
  • 4
  • 8
1

Where is the fun when you learn how to break things, but not how to efficiently setup, backup and repair? Besides, such kind of question reminds me of the law of the instrument.

The other option: Avoiding re-installations where possible

Use dedicated partitions/filesystems like a home partition

You can have persistent files in your home directory by just using a different partition for /home in /etc/fstab. You don't need to re-install to configure this.

Additionally instead of mounting an overlayfs accross your entire installation, you could mount one or more to the directories where you need them, this should be possible.

Do backups

Even if it's just your testing machine. You wouldn't go through the time and bandwidth consuming process of re-installation and configuration, if you already knew how to get back to the state before the issue occurred that broke presumably everything. (To break it again and again and eventually learn what broke and how to fix.) Installing the same operating system will not teach you knew things nor will it ever fix the cause of an issue, you just click buttons faster.

Learning how to create, restore and verify backups on the other hand will save you time, money and stress on all your computers.

New things to learn

Please take a look at Comparison of backup tools. You could also use a filesystem with snapshot functionality like , which is similar to an overlay filesystem, but not a replacement for proper backups.

You should also learn about (how to get back to default package configuration), and (to document changes to config files for yourself, when you try things out).

LiveWireBT
  • 28,763