can't use borg mount-ed device file backup for loop device
From IRC:
It does not seem I can mount a device via a loop device (too bad, wanted to mount it without having to extract it):
# borg mount -o allow_root,dev,suid /repo::today /mnt
# losetup -f -r /mnt/dev/dm-18
losetup: /mnt/dev/dm-18: failed to set up loop device: No such device or address
(borg-env)tw@tux:~/w/borg$ borg --version
borg 1.0.4.dev62+ng02c72b9
(borg-env)tw@tux:~/w/borg$ borg create --read-special repo::spe /dev/sda1
(borg-env)tw@tux:~/w/borg$ borg list repo::spe -v
brw-rw-r-- root disk 0 Fri, 2016-07-01 13:25:41 dev/sda1
(borg-env)tw@tux:~/w/borg$ borg mount repo::spe mnt
(borg-env)tw@tux:~/w/borg$ ls -l mnt/dev/sda1
brw-rw-r-- 1 root disk 0, 0 Jul 1 13:25 mnt/dev/sda1
(borg-env)tw@tux:~/w/borg$ sudo mount -o loop,ro mnt/dev/sda1 mnt2
mount: mnt/dev/sda1: failed to setup loop device: Permission denied
Hmm, I suspect it is confused by mnt/dev/sda1 mode saying it is a block device, but it should be "regular file".
Considering that, I guess that this was not a sufficient fix: https://github.com/borgbackup/borg/pull/1216/files
Guess if we open and read the special file (like block device) like a regular file, we also have to reflect "regular" file in the item's metadata in the archive (and can not store the original mode there).
Can you try sudo losetup -P /dev/loop0 mnt/dev/sda1 and then fdisk -l /dev/loop0 and ls /dev/loop0*? (assuming you don't have any loop devices mounted, if you do use loop1 or similar)
@PlasmaPower what should running fdisk on a partition without MBR be good for?
@ThomasWaldmann Oh, oops, I thought it was /dev/sda for some reason. Just see if sudo losetup /dev/loop0 mnt/dev/sda1 works.
Fixed the mode, still no success:
(borg-env)tw@tux:~/w/borg$ ls -l mnt/dev/sda1
-rw-rw-r-- 1 root disk 499122176 Jul 1 13:25 mnt/dev/sda1
(borg-env)tw@tux:~/w/borg$ sudo losetup /dev/loop0 mnt/dev/sda1
losetup: mnt/dev/sda1: failed to set up loop device: Permission denied
crap, it was that allow_other/allow_root trap again.
now it works. :)
I confirm it works now :)
# borg mount --info --debug -o allow_root /backup/repo::archive /mnt
# losetup /dev/loop0 /mnt/dev/dm-18
# mount -o ro /dev/loop0 /mnt2
https://github.com/borgbackup/borg/pull/1242 was merged into 1.0-maint.