From: "Niccolò Belli" <darkbasic@linuxsystems.it>
To: <linux-btrfs@vger.kernel.org>
Subject: My system mounts the wrong btrfs partition, from the wrong disk!
Date: Fri, 25 Nov 2016 12:05:57 +0100 [thread overview]
Message-ID: <a39949b5-abab-40a3-943e-818b6ca7106b@linuxsystems.it> (raw)
This is something pretty unbelievable, so I had to repeat it several times
before finding the courage to actually post it to the mailing list :)
After dozens of data loss I don't trust my btrfs partition that much, so I
make a backup copy with dd weekly. Yesterday I was going to do some
balancing and deduplication, but since the disk was full I had to remove
the content of a whole subvolume (16GB) to make some space available to the
tools (I had the backup made with dd on an external drive).
After the balance and deduplication I attached and mounted the external
drive with the backup and then I mounted the img file with the copy of the
partition. To my great wonder the subvolume in the backup which should have
had the files I deleted was empty! So I rebooted to a live usb and mounted
the backup again: my files were still there, phew! Then I mounted the
partition in the laptop's disk and I tried to copy the files from the
backup and it complained that they already existed! If I unmount both the
backup and the real disk and then I mount the real disk it's empty again as
it should.
These are the exact steps to reproduce it from the live usb:
# Opening the encrypted partition from the real disk and then mounting it
cryptsetup luksOpen /dev/sda5 cryptroot
mount -o noatime,compress=lzo,autodefrag /dev/mapper/cryptroot /real_disk
ls /real_disk/@Pictures --> empty (as it should)
# Mounting the external disk with the backup
mount /dev/sdb1 /external_disk
# Mounting the unencrypted backup from the external disk
mount /external_disk/backup.img /backup
ls /backup/@Pictures ---> empty (*it shouldn't!*)
umount /backup
umount /external_disk
cryptsetup luksClose cryptroot
# Mounting the external disk with the backup
mount /dev/sdb1 /external_disk
# Mounting the unencrypted backup from the external disk
mount /external_disk/backup.img /backup
ls /backup/@Pictures ---> 16GB of photos (as it should)
# Opening the encrypted partition from the real disk and then mounting it
cryptsetup luksOpen /dev/sda5 cryptroot
mount -o noatime,compress=lzo,autodefrag /dev/mapper/cryptroot /real_disk
ls /real_disk/@Pictures --> 16GB of photos (it *shouldn't!*)
I really don't know where the bug may lie, probably not even in btrfs but I
didn't know where to report it. I'm using Archlinux with kernel 4.8.10 and
the live is an Arch live usb with kernel 4.8 too.
Niccolò Belli
next reply other threads:[~2016-11-25 11:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-25 11:05 Niccolò Belli [this message]
2016-11-25 11:17 ` My system mounts the wrong btrfs partition, from the wrong disk! Roman Mamedov
2016-11-25 23:56 ` Chris Murphy
2016-11-26 13:24 ` Goffredo Baroncelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a39949b5-abab-40a3-943e-818b6ca7106b@linuxsystems.it \
--to=darkbasic@linuxsystems.it \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).