Hello, I've been a long time Linux user but I had a 5 years break and I am coming back to it now.
I've been trying several Linux distributions in the past week, installing the packages and configuring them as I need with several different orders of success.
My last case was an Ubuntu installation that I was very happy with and pretty close to call it setup and done, until I installed virtualbox and restarted the system only to find it bricked.
Obviously I could try to drop into one of the terminals on ctrl + alt + Fx and fix it, but I wonder if I could be smarter about it and be more prepared for this kind of situation.
One of the starting points I think would be having a separate home partition from the rest of the system. I used to have it in the past and it was great.
But then what's next? What are the best FS I could pick for each type of partition? A performant one to keep the code and package manager cache, a journaling/snapshop based one for system, another type for game data, etc etc.
What if I would like to have a snapshot of working version of my system backed up somewhere ready to restore as simple as simple as possible?
How do you configure your systems in order to quickly recover from an unexpected bricking without growing some more white hairs, and squeezing as much performance vs feature for each of your use case?
Well having a dedicated
/home
partition is the very minimum and pretty much default.If you are interested in having a backup/restore solution for your system you are looking for
BTRFS
which uses sub volumes instead of primary partitions and is compatible with snapshot tools, those tools being Timeshift and Snapper.I do think Snapper is the superior solution however it's also more complex to set up and requires significantly more prep work. Imo totally worth it.
I currently use it on my main machine Debian with BTRFS and Snapper and couldn't be happier.
Nothing, I just corupted my hard drive with all my college work for tomorrow and im trying to save them, im feeling so stupid rn, im nothing but a failure at this point
I hope that this link can help save your data. You might need an external HD to recover the data to as well as a live USB you can install testdisk to.
https://www.howtogeek.com/700310/how-to-recover-deleted-files-on-linux-with-testdisk/
Here is a video and there are plenty more on YouTube.
https://www.youtube.com/watch?v=3jbWfGePrqo&t=0
Maybe you can get an extetion from your professorto buy yourself a bit more time to recover your data? Best of luck.
On servers I like to have /var on its own partition. Partially as a habit from the olden days of using FreeBSD in the 90's, but also because that means that / will mostly be left with things that don't really change. I've had to clean out clogged up / too many times. So in effect, my partion schema for a typical production server looks like this:
/ ext4
/local xfs
/global usually beegfs or nfs, but sometimes a local xfs.
/var ext4
/home ext4Besides btrfs, there are immutable distros like fedora silverblue. The system doesn't update when something goes wrong during the update and you can roll back if it updated.
It is a bit more difficult to handle and understand, imo, for a new linux user if the user wants to tinker with the system.
Thanks for all your comments, a lot of interesting things here.
I went with BtrFS with Timeshift. Seems to have improved in terms of performance a lot that I barely noticed any difference compared to the previous installation with Ext4, if any at all.
Unfortunately the current Ubuntu 23.10 installer doesn't properly set btrfs subvolumes correctly for
and
@home
and instead instead just throws the entire OS at the root of the FS, making it incompatible with Timeshift and causing FS snapshots to live in the Linux directories, which in turn would cause future snapshots to contain snapshots, not great...Fortunately migrating to a subvolume layout is possible although it was quite painful following this outdated and a bit not well written post https://www.reddit.com/r/btrfs/s/qWi84tGJam
After successfully installing the system and setting up btrfs layouts and Timeshift, I created the first system snapshot and I feel extremely confident about this solid system.
Thanks again for sharing your experience!
Right now I'm using Garuda Linux, it takes a snapshot during major updates. Easily restored if something breaks.
Time shift saved my but a time or two in the past.
I simply backup the /home folder, where the important files are with duplicity on my home server with ftp once a week, keeping records of the last 6 months. But as that only restores the home folder i also take a snapshot (which takes way more disk space) every month with timeshift too, which stays on the pc. Would be great if i could take complete snapshots via ftp just like with duplicity, but timeshift doesn't do that.
I only have three partitions, all ext4:
/dev/sda1
mounted as/
- if necessary I wipe it out, reinstall my junk and call it a day. The only non-default things there are a few/etc
files but I got a manual backup of the ones that matter. It's in the SSD to access is really fast./dev/sdb1
mounted as/home
- that's my precious, for files that are personal and/or impossible to replace. Kept as small as possible so I can mirror it into a USB stick. It's in the HDD, right at the start so access is fast./dev/sdb2
mounted as/storage
- originally I created this partition to bulk store my anime series, music, etc. so I could broadcast them through SMB across my house. If I lose those files I'll probably be pissed, but they can be recovered with some sweat, blood, and torrents. Access speed is not that big of a concern for those files.
I'm actually considering to create a fourth partition. See, the
/storage
partition has 1.6 TB, so I created a/storage/binarios
subdir in it so I can install a few programs (mostly games)... that's just/opt
reinvented poorly, might as well promote it to its own partition.I use NixOS & Home Manager. My config is in
git
, and I use an ephemeral setup with ZFS & tmpfs:Mount layout:
/ tmpfs ├─/boot /dev/sda1 FAT32 EFI system partition ├─/nix rpool/local/nix ZFS partition ├─/home/persist rpool/safe/home ZFS partition └─/persist rpool/safe/persist ZFS partition
ZFS partitions under rpool/safe/ get backed up, the rest don't need to be. Everything else can be rebuilt (and most of it gets re-created at boot anyway, since / and /home are tmpfs).
Not really partition related but in terms of backups, state replication and reliability:
State of Systems: NixOS configs. Art: Borg + Borgbase. Code: Git + Sourcehut.
500 MiB ESP mounted at /efi Swap equal to my RAM at /home/swapfile Root equal to 25% of my disk, formatted with btrfs with auto snapshots. Home takes the rest of my disk, formatted with btrfs WITHOUT AUTO SNAPSHOTS, so swap works.
I have my EFI boot partition with 512M on /boot, zram instead of swap, then a whole lot of btrfs subvolumes, with RAID across several disks. I do a lot of snapshotting, and auto-snapshotting, but thats mostly for local rollback. I only btrfs-send to a machine on the LAN. For my real backups I use Restic, sending that data to a number of places.