[Solved] Which file system to use for a backup partition? BTRFS?

A week ago I got a new laptop and switched from Windows 10 to Fedora 34 (not dual boot, Fedora and Windows are on separate drives). My Fedora 34 nvme drive is encrypted (LUKS) and is BTRFS. See attached pic. I’ve got a 2TB NTFS formatted external drive that I want to use. I used gparted to create about 1.5TB of unallocated space on the external drive (see pic). I want to backup my Fedora 34 drive to the unallocated space on the external drive. I’m assuming I should format the unallocated space to be BTRFS? Or should I use some other file system? I’m also assuming that I can tell Timeshift (or some other backup program) to send the backup to the new partition? This is the first time I’ve played around with gparted and partition resizing, so I’m inexperienced.

Don’t use BTRFS. Use something like ext4 or XFS. If you want to be able to view your backups on a Windows machine go with Fat32 or exFAT. You might need to install exFAT packages to get this to work in gparted.

1 Like

Uh oh. I went ahead and formatted it to BTRFS and started the backup. It seems to be proceeding normally. Will using BTRFS cause problems? If yes, what kind of problems? Thx. I can start over again if needed.

I don’t think I’ll have any need of accessing the backup files from a Windows machine.

You won’t experience anything terrible. BTRFS has a lot of inbuilt functionality that just won’t be utilized at all by a periodic backup.

1 Like

Could you elaborate a little on this? I’m a newbie. Thx. Will I be able to restore from the BTRFS formatted backup drive?

When integrated into a system like Fedora or openSUSE BTRFS will take system snapshots before and after certain events. This is in case an update breaks your system, you can always go back in time to the previous snapshot before the update. But this is all scheduled and scripted by the system developers to make it automatic. BTRFS snapshots are stored on the disk so they take up space of their own.

If you just have an external disk formatted as BTRFS none of that automatic snapshot behavior is going to be there.

In practice a backup would never need to be rolled-back to a previous version of the backup from a BTRFS snapshot. You would just have another backup on another disk for that. And the space consumed by snapshots on a backup of user files would be huge and impractical.

You’ll be able to restore the backup from that drive.

1 Like

Thanks. This is helpful. I tried to use Timeshift/BTRFS but got this error. See image. Anyway to fix this? Thx. Do I need to include the ‘@home subvolume’ in the backup? Do I need to make a separate partition on my main drive?
.
2021 07 12, Timeshift BTRFS error, Screenshot from 2021-07-12 14-34-44

Btrfs snapshot is a different thing from the rsync one.
It uses the copy-on-write nature of Btrfs to create snapshot, which doesn’t take extra spaces, what it does is keeping the old data without deleting them when new data comes. To use this function, you don’t need external drive for backup as it’s simply rolling back to the older data.

Timeshift only support Ubuntu way of handling Btrfs subvolumes, to do it in Fedora, it’s easier to set it up when installing the system. By choosing Advanced Custom option when partitioning, create an empty Btrfs volume, then choose the Btrfs volume at the left panel, then create subvolumes (one named @ mounted at /, one named @home mounted at /home)

If you wanted to backup at external drive, then you can simply use the rsync option.

Also take note that you can enable zstd compression for Btrfs to save some spaces, it’s currently saving 36% of spaces for me. Here is the guide from Fedora Magazine. AFAIK it’ll be enabled by default if you create subvolume in Fedora 34 and might not be enabled by default if you use the whole volume directly.

1 Like

@leekaize Thanks for the info. So, if I understand correctly, to use Timeshift BTRFS snapshots, I have to reinstall from scratch my whole Fedora 34 installation. Is that correct? Can I create volumes and sub-volumes using gparted?

To my knowledge, reinstall the whole system is the only easy way to switch your root partition into subvolume. One alternative is just shrink current root and home, create a new btrfs volume with subvolumes, copy your current root and home into the subvolumes. Delete the original root and home, edit /etc/fstab to use the new volume. (I’m not suggesting you to do this anyway…)

As you’re going to use an external drive to backup, I would suggest don’t bother with Btrfs snapshots and simply use rsync.

I don’t think gparted support managing Btrfs subvolumes, I use terminal for it.

1 Like

@leekaize I found the guide here A quick guide to setting up BTRFS Timeshift on Fedora 33 - Desktop - Fedora Discussion It’s above my head but I may try it.

1 Like

Oh yeah that’ll works, I’ve to apologise that I somehow thought I was replying to another thread I replied today :rofl: which use seperated / and /home. I just reread your post and seems like you’re using default Fedora setup, so the guide you share will works :grinning:

1 Like

Lets clarify something. This thread is about making a backup to an external drive with Timeshift and that external drive happens to be formatted as BTRFS. The most obvious problem is that BTRFS does not support storing snapshots on external disks. Here’s a screen cap from Timeshift:

image

BTRFS is not a backup solution but a “roll-back” solution, in fact, Timeshift is not designed to be used to backup user directories either.

Here’s an excerpt from the Timeshift github page https://github.com/teejee2008/timeshift

" It is designed to protect only system files and settings. User files such as documents, pictures and music are excluded. This ensures that your files remains unchanged when you restore your system to an earlier date."

This really only applies if you include your home directory in the same snapshot alongside the system directories that Timeshift includes by default. So if you roll-back the system to a previous snapshot, your home directory will get rolled-back too. Resulting in data loss.

You can still use it to backup your home directory and personal files, using RSYNC, to an external disk. You just have to make separate snapshots for system and home directories. But it becomes a little annoying to switch Timeshift between these two different uses.

As far as the external drive is concerned. If it is BTRFS that will not have an effect on making RSYNC backups. It just doesn’t benefit from any BTRFS features.

If your internal system drive is formatted BTRFS and it was done incorrectly then you won’t be able to make BTRFS snapshots. But Timeshift can still make RSYNC snapshots/backups.

The difference is that BTRFS snapshots are a function of the File System itself. RSYNC is File System agnostic, it only deals with the data regardless of the File System.

My recommendation would be to make an RSYNC backup of just your home directory on your external disk. Then redo your installation to setup BTRFS properly this time. Setup Timeshift to make BTRFS snapshots of system files only, this is the default, and use a different tool like Deja Dup to make home directory backups to an external disk. Once your personal files are off the external disk, reformat it to ext4.

2 Likes

I changed the formatting on the external drive partition from btrfs to ext4 and tried Deja Dup. Deja Dup keeps saying ‘error, permission denied’ when it tries to write to that partition. The details of the situation are on the other thread related to this.

To make a long story short, I’m giving up on Fedora (what a nightmare!) and will try Ubuntu. So this thread is resolved. Thanks for all your replies! Appreciated.

I would go with ZFS. It is gaining popularity as it is power failure tolerant unlike EXT4

1 Like

@Trent

I’m using a laptop so power outages not an issue.

Thanks for the suggestion re ZFS. I did some research and it looks like

  1. ZFS uses more RAM.
  2. It requires some additional technical knowledge to set up and maintain (I’m a Linux newb and I’ve learned the hard way to strongly avoid going down any technology path that requires additional technical knowledge (I don’t want Linux to turn into a hobby). I stick with only the simple, newbie-friendly tech options.
  3. ZFS is designed for server systems handling big data. I’m just a laptop newbie browsing the web, writing my stories and not much else.
  4. Using ZFS required me to do some extra steps in the Ubuntu install process and I didn’t want the hassle and technical risk.
  5. I was trying Fedora 34 with BTRFS and it seems to be slower than using ext4 on Ubuntu.
  6. My system snapshot needs are simple and basic and it looks like Timeshaft/Rsync can handle them. Do I need something more?
  7. I haven’t researched this, but I’m pretty sure there are reliable tools I can use to periodically check the health of my ext4 filesystem.
  8. I’m careful about backing up my files. I’ve got a large, well organized collection of carefully labeled external drives and a spreadsheet tracking every backup job and restore test.

With that being said, I’m happy to hear your thoughts about how ZFS is preferred, in spite of my 8 points. Thx.

  1. ZFS uses as much RAM as you allow it to use. You can choose the min and max sizes of the memory cache. See also point 3.
  2. Valid argument, however the command line of ZFS is not complex.
  3. I use it on my 2019 Ryzen 3 desktop with 16GB of DDR4 and on my 2011 i5 Sandy Bridge laptop with 8GB of DDR3 and on my backup-server a 2003 Pentium 4 HT with 2GB of DDR running 32-bits FreeBSD 13.0 also on OpenZFS 2.0.
  4. There are no additional steps in the install process, just select zfs.
  5. Ext4 will boot faster, but afterwards ZFS will be faster, because it will reload programs and data from the lz4 compressed L1ARC memory cache.
  6. You don’t need more, if you are prepared to wait the time, needed for the snapshot to complete. All ZFS snapshot commands are simple, like “zfs snapshot dataset-name@snapshot-name” and all commands (snapshot; rollback and destroy) complete within a second. A dataset is a ZFS folder with additional physical properties.
  7. No, you can’t find those tools, since ext4 does not protect against crashes, that occur, while a file is updated. Ext4 can’t detect a violation of the internal file format, it only can detect issues in the partition administration. With e.g. audio files, you will detect the next time you play it, that it is garbled. I live in a country with 2 to16 power fails per week, so I found it out the hard way.
  8. You will not detect, that files are garbled, till you use it and then you have to hope, that you still can find an uncorrupted file in the backup.

Would I advice you to switch to ZFS, not really. The chance of file corruption is small in your case and ext4 boots faster and works fine also during normal use.

Personally I always switch off the automatic snap-shotting of ZFS in Ubuntu by deleting zsys. I have small 3 line scripts to create, rollback or delete Ubuntu system snapshots. It allows me to use my own snapshot names.
Scrip to create a snapshot (-r means recursive):
sudo zfs snapshot -r bpool/BOOT@$1
sudo zfs snapshot -r rpool/ROOT@$1
sudo zfs snapshot -r rpool/USERDATA@$1

1 Like

ZFS is on another level. Have you ever used Sanoid for snapshot management?

1 Like

@BertN45 Good points. Thanks.

Point 1. I’d have to research and get smart on how much RAM to apply to ZFS in my situation. The necessity to do things like that usually discourage me from using new tech (unless, for some reason, there’s a strong need or desire for me to use that new tech).

Point 2. I’m sure that’s true, but it’s another thing I would have to learn. And that would push my experience with Linux into hobby territory and I have other priorities.

Point 4. I didn’t memorize what I saw, but I vaguely remember that selecting ZFS in the Ubuntu 21.04 install process required more steps (perhaps my memory is off, wouldn’t be the first time :slight_smile: .) But the main reason is I didn’t know anything about ZFS and didn’t have time in that moment to stop and research.

Point 6. I had bad experiences messing with the command line in Fedora 34, so I’m inclined to avoid things that require command line (unless required).

Point 7. I haven’t looked into it in detail, but I found this page 4 Tools to Manage EXT2, EXT3 and EXT4 Health in Linux It may not be what the title implies. But no time to research. Also, I’m using a laptop so short power outages not a worry. Am I missing something?

Point 8. Good point. I do want to avoid data corruption. Hopefully ext4 will be stable. Probably at some point I’ll want to rebuild my Ubuntu system from scratch. I’ve made a note to explore using ZFS for that.

Thanks for all the great details. This is helpful.