Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Backgroud: Running XBian (Debian ARM distribution for Raspberry Pi), which uses BTRFS. I fragged my system and decided to start over. However, I ripped the image from the root filesystem device before starting fresh.

I have a running BTRFS system, and an image (raw filesystem data) file which contains the data from a previous installation. I want to access the data from this image file to restore configuration and things like that. So, I mount this image with the following command (I found the offset with fdisk /path/to/image.img, print, and then multiplied the start sector by 512, the sector size - e.g. start sector 10000, offset = 512*10000 = 5120000):

mount -t btrfs -o loop,offset=5120000 /path/to/image.img /mnt/prev-image

After this command, I see that (at /mnt/prev-image/) the filesystem doesn't look as straightforward as ext2 or other traditional filesystems. I am probably having a misunderstanding at this point, or with the mount command.

When I try to access a file from the image, say my Samba configuration, I navigate to /mnt/prev-image/root/@/etc/samba/smb.conf. But, I notice that I'm seeing the same filesystem as my main filesystem and that the smb.conf file I access is the same as my current Samba configuration in /etc/samba/smb.conf. I think BTRFS is treating the data in the image file as a baseline snapshot for my base system, and serving me the "latest" smb.conf file, which comes from my fresh installation.

I want to know how to access the data from the image file, and where my misunderstandings lie.

share|improve this question

1 Answer 1

Your probable problem is that you've mounted the wrong subvolume. To mount the "parent" subvolume, throw an additional parameter into your "-o" section: subvolid=1 such that your whole line would now look like

mount -t btrfs -o loop,offset=5120000,subvolid=1 /path/to/image.img /mnt/prev-image

I think that should do the trick for you.

share|improve this answer
    
Mounting like this still merges the filesystems so that I can't see the two separate files. This works well when mounting on a non-btrfs system, though. –  palswim Feb 28 at 19:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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