You are not logged in.

#1 2021-08-19 23:52:52

T41US
Member
Registered: 2021-08-19
Posts: 12

[solved] btrfs for timeshift help

Hello all, I installed arch recently, and am having a great time with it! I used Btrfs as a filesystem because I wanted to use the Copy-on-write functionality for Timeshift as a backup measure. It seems since I haven't set up subvolumes, I can't back up my files, as Timeshift needs /home mounted on the @home subvolume. Is there a way to properly move my files without causing a large hassle, or breaking anything (much)?

Edit: I managed to use this guide to shuffle subvols, but couldn't get Timeshift to work, as it crashes in setup.

Last edited by T41US (2021-12-06 03:52:51)

Offline

#2 2021-08-21 02:31:46

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [solved] btrfs for timeshift help

If you just installed Arch, the easiest solution is probably to just start over. Not all over again, but from the disk setup part. Do you have lots of files in your home? Consider backing them up to external media (hard drive, or even a cloud provider), then re-create your partitions, then restore the files.
I say easiest because it doesn't involve much fiddling with learning how to use btrfs - destroying and recreating is always easier (albeit more time consuming) than reconfiguring partitions on-the-fly.

Offline

#3 2021-08-21 07:45:01

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: [solved] btrfs for timeshift help

First make a backup with Timeshift in RSYNC mode. Then create the subvolumes somehow.

If your original files and the subvolumes are still on the same partition, you can move the files (including any hidden dot files) as the root user into the subvolumes. Of course, the files should not be in use when you move the files, so do it for example from a live USB or lower your systemd level to the rescue.target.

Otherwise use Timeshift to restore the files. (Disclaimer: never used Timeshift myself.)

Offline

#4 2021-08-21 15:42:17

T41US
Member
Registered: 2021-08-19
Posts: 12

Re: [solved] btrfs for timeshift help

I don't have many files, I'm just afraid that I'll mess something up on reinstall, honestly. An OS reinstallation might be the better option. As for using rsync with Timeshift, It looks like Timeshift is not recognizing my btrfs partition for some reason. Would it be possible to use an install USB to set subvolumes?

Offline

#5 2021-08-21 16:43:53

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: [solved] btrfs for timeshift help

Yes, it is possible. Do it from a live USB. Run as root user.

To find the Btrfs partition:

blkid

Then do something like this. Please check before running this:

mount -o defaults,subvol=/ /dev/sdX /mnt
btrfs subvolume create /mnt/root
mv /mnt/* /mnt/.* /mnt/root

Edit /mnt/root/etc/fstab. Add ",subvol=/root" to the mount options for the root folder/subvolume.

Then repeat the steps for the "home" subvolume.

Update the bootloader. For grub, regenerate grub (which should generate "rootflags=subvol=root" in grub.cfg).

Unmount the partition.

It best to make some kind of backup first (using tar, for example), but it is not absolutely necessary if you are willing to take the risk.

Offline

#6 2021-08-21 19:57:22

T41US
Member
Registered: 2021-08-19
Posts: 12

Re: [solved] btrfs for timeshift help

Wouldn't this just make a @ subvolume? What about a @home subvolume? Would I do
```
mount -o defaults,subvol=/ /dev/sdXy /mnt
btrfs subvolume create /mnt/root/home
mv /mnt/* /mnt/.* /mnt/root/home
```
or something similar for @home?

Last edited by T41US (2021-08-21 19:57:35)

Offline

#7 2021-08-21 20:29:27

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: [solved] btrfs for timeshift help

I use Btrbk for making snapshots and replication/backups. With Btrbk you can choose your own subvolumes layout. I chose layout: /root, /home, ... (the leading / can be left out, I think).

You can of course change the subvolumes layout and maybe make use the default subvolume (now or later). Depends somewhat on which Btrfs tools you plan on using. For example, to make it compatible with maybe Snapper: subvolume names/paths starting with @.  Have home under root (root/home) or have home next to root. Check how Timeshift expects the layout to be, if any.

So, yes, you can do /mnt/root and /mn/root/home  or  /mnt/@ and /mnt/@home. But keep in mind that a snapshot is never nested. Snapshotting root will not snapshot root/home.

Note that Snapper only does snapshots, not replication / (remote) backups.

Offline

Board footer

Powered by FluxBB