49
submitted 21 hours ago* (last edited 20 hours ago) by Cornflake@pawb.social to c/linux@lemmy.ml

Hey there, folks! Currently playing around with a laptop that's got three SSDs. Running Arch but that isn't quite related. I have everything configured on one SSD, the other two are totally fresh. What do I need to do to setup one of those fresh SSDs for Timeshift backups? Please walk me through it from the very start- I think I understand some parts but I'm not too certain.

I can format the drives using mkfs.btrfs without any issues, but I'm confused about how I can add subvolumes and configure their root permissions properly to allow Timeshift snapshots.

EDIT: I see now that I misunderstood what Timeshift does. New question- which tool can I use to make a backup of my entire filesystem onto another drive such that it can be restored?

you are viewing a single comment's thread
view the rest of the comments
[-] zarenki@lemmy.ml 9 points 18 hours ago

The command you're looking for is btrfs send. See man btrfs-send.

I know of at least one tool, btrbk, which automates both automatic periodic snapshots and incremental sync, but here's an example manual process so you can know the basic idea. Run all this in a root shell or sudo.

As initial setup:

  • Create a btrfs filesystem on the sender drive and another on the receiver drive. No need to link them or sync anything yet, although the receiver's filesystem does need to be large enough to actually accept your syncs.
  • Use btrfs subvolume create /mnt/mybtrfs/stuff on the sender, substituting the actual mount point of your btrfs filesystem and the name you want to use for a subvolume under it.
  • Put all the data you care about inside that subvolume. You can mount the filesystem with a mount option like -o subvol=stuff if you want to treat the subvolume as its own separate mount from its parent.
  • Make a snapshot of that subvolume. Name it whatever you want, but something simple and consistent is probably best. Something like mkdir /mnt/mybtrfs/snapshots; btrfs subvolume snapshot /mnt/mybtrfs/stuff /mnt/mybtrfs/snapshots/stuff-20250511.
  • If the receiver is a separate computer, make sure it's booted up and running an SSH server. If you're sending to another drive on the same system, make sure it's connected and mounted.
  • Send/copy the entire contents of the snapshot with a command like btrfs send /mnt/mybtrfs/snapshots/stuff-20250511 | btrfs receive /mnt/backup. You can run btrfs receive through SSH if the receiver is a separate system.

For incremental syncs after that:

  • Make another separate snapshot and make sure not to delete or erase the previous one: btrfs subvolume snapshot /mnt/mybtrfs/stuff /mnt/mybtrfs/snapshots/stuff-20250518.
  • Use another send command, this time using the -p option to specify a subvolume of the last successful sync to make it incremental. btrfs send -p /mnt/mybtrfs/snapshots/stuff-20250511 /mnt/mybtrfs/snapshots/stuff-20250518 | btrfs receive /mnt/backup.

If you want to script a process like this, make sure the receiver stores the name of the latest synced snapshot somewhere only after the receive completes successfully, so that you aren't trying to do incremental syncs based on a parent that didn't finish syncing.

this post was submitted on 11 May 2025
49 points (98.0% liked)

Linux

54100 readers
742 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS