13

I've made backups of my BTRFS filesystem using Clonezilla, and have restored one of those backups to a file named 2013-11-29.sda3.img.

I need to get some files out of this backup, but there's a hitch. Since the backup is of this machine, I cannot mount the backup anywhere on my filesystem, as its UUID matches the UUID of /.

Is there a way that I can change the UUID of the backup volume? As I understand it, BTRFS stores UUID information in every block on the filesystem, which complicates things for my purposes. However, is there a way that I could modify this? I understand that it'd probably take a long time to do, but that doesn't concern me. My main concern is keeping the server online. The backup is fairly large, so transferring it to another machine would take quite a while.

What are my options?

-1

There is no way to do that for the moment. Actually, the volume UUID is used in each node of the chunk tree. You'll have to change them in there also assuming that the headers of the chunks/device are not hashed. BTRFS was really not design to allow this kind of backup.

This is really sad, but the easiest way to handle that is to use another computer.

If I may, I'd like to suggest you to stop backuping your data this way.

  1. If your partitions are important as a whole, backup with dd/clonezilla. When you need to restore your backups, restore the whole partition at once. Don't do this kind of hybrid backups: you specifically saved your partitions at the bloc level. So you have to restore it at the bloc level. Otherwise, you are using a spoon to cut the meat. As you certainly noticed, this solution is usually not used because it offers no versatility.

  2. If your data are important, backup with rsync or a similar tool on another disk : your data will always be accessible, you backup exactly what you want, you are backuping at the file level, etc.

Note that BTRFS has some (now limited) backuping features. BTRFS is moving fast, I guess more backuping features will come out in the future.

Oh, you've been warned already ;) Automated Clonezilla backup and GPG encryption

BTW, encryption is easier to apply on files using either LUKS for partition-based encryption or EnFS or EncryptFS for file-based encryption.

  • The main question was how to simply mount an image backup, when the image FS is BTRFS. I guess I'm going to have to make another Clonezilla backup of my current operating system status, restore the old backup, do what I need to do, and then restore back to current. Wish there was an easier way, but hey, if it works, it works. – Naftuli Kay Dec 11 '13 at 21:16
  • The main answer is that you can't if it shares the same UUID as another partition on the disk :) – user21228 Dec 12 '13 at 20:29
20

With the program btrfstune, which is part of more recent versions of the normal btrfs-tools, the UUID of a offline file system can be changed. If the partition is eg. /dev/sda1, use following command to generate a new, random UUID:

btrfstune -u /dev/sda1

To specify which value should be used, use an uppercase -U followed by a (valid) UUID string, for example:

sudo btrfstune -U e0c5b943-1c02-44a2-bbaf-87ebda5e363b /dev/sdaX

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.