ZFS Mounting a partiton of a ZFS poolfile?

Hi there, I have a file, it's 2 TB in size. The sender said: this is a zfs poolfile. I did setup a Ubuntu 22.04 in VirtualBox, connected the USB drive with the 2 TB ZFS poolfile, mounted it in Ubuntu and typed in: fdisk -l zfsfile01. Ubuntu said:
Code:
toor@toor-ZFS:/media/sf_E_DRIVE$ sudo fdisk -l zfsfile01
Festplatte zfsfile01: 1,82 TiB, 2000398934016 Bytes, 3907029168 Sektoren
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
Festplattenbezeichnungstyp: gpt
Festplattenbezeichner: 44E0E83D-A9CA-11EC-xxxx-xxxxx
Gerät       Anfang       Ende       Sektoren   Größe Typ
dataset1    128          4194431    4194304    2G FreeBSD Swap
dataset2    4194432      3907029127 3902834696 1,8T FreeBSD ZFS
toor@toor-ZFS:/media/sf_E_DRIVE$
the dataset1 and ..2 could be a partition, too. I do not know exactly.

Question: how can I mount the zfsfile01 as a loop dump file and mount also the dataset2/partiton 2??
I have tried:
Code:
losetup -f //  got the loop8 as a next free device, then: 
losetup /dev/loop8    /media/sf_E_Drive/zfsfile01 // got error: not possible: error msg is like (german) not possible, progress not valid
zpool import  /media/sf_E_Drive/zfsfile01  // got error: no such pool available, i est. i need a loop back device at first.
Must I mount the pool file AND the partition (above: dataset2) in one command?
I come to you because the fdisk -l shows a FreeBSD type and at the ubuntu-forums (https://askubuntu.com/questions/1441781/mount-a-zfs-poolfile-with-dataset-as-a-loopback) mentioned, that there could be a special thing because the partition is a FreeBSD - Type.

Can you help me? Thanks a lot, Alois.
 
The english Command Outputs are:
Code:
toor@toor-ZFS:/media/sf_E_DRIVE$ sudo fdisk -l zfsfile01
[sudo] password for toor:
Disk zfsfile01: 1,82 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 44E0E83D-A9CA-11EC-83AA-AC1F6B171272
Device       Start        End    Sectors  Size Type
dataset1   128    4194431    4194304    2G FreeBSD swap
dataset2   4194432 3907029127 3902834696  1,8T FreeBSD ZFS
Code:
toor@toor-ZFS:/media/sf_E_DRIVE$ sudo losetup /dev/loop8 /media/sf_E_DRIVE/zfsfile01
losetup: /media/sf_E_DRIVE/zfsfile01: failed to set up loop device: Operation not permitted
toor@toor-ZFS:/media/sf_E_DRIVE$
My Question: how can I mount the zfsfile01 as a loop dump file and mount also the dataset2/partiton 2??

Thanks again, Alois
 
Thanks, for your answer. Yes, i guess, too, that the file is just a disk image. I have already tried to mount it:

Code:
sudo mount -o loop /media/sf_E_DRIVE/zfsfile01 /home/toor/zfsfs
Error:
mount: /home/toor/zfsfs: failed to setup loop device for /media/sf_E_DRIVE/zfsfile01.

Code:
toor@toor-ZFS:/media/sf_E_DRIVE$ sudo losetup /dev/loop8 /media/sf_E_DRIVE/zfsfile01
Error:
losetup: /media/sf_E_DRIVE/zfsfile01: failed to set up loop device: Operation not permitted

<<So, mount the disk image>>
Yes, i would like to mount the image; how would you like to do this?

Alois.
 
Yeah, it's not a zfs-send file, it's a full disk image with gpt partitioning, a freebsd swapspace and a freebsd zfs image.
If it is actually a file, I would mount that with mdconfig, and then import.

But then: what is a loop dump, what is a VirtualBox (and what is an Ubuntu? ;) )

Hm, it seems loop devices are something strange that is vaguely similar to mdconfig but encrypted. Or whatever.
And they support an offset. So what happens if that loop is created from the beginning of dataset2, i.e. 4194432 * 512 = 2147549184 (as parameter to that -o option)?
 
If you set up a basic FreeBSD install we can probably guide you further. You don't need anything 'special' with regards to the installation, just the base OS will be enough. Use FreeBSD 13.1 if possible, it has the latest version of ZFS and should be able to read a ZFS pool from any of the previous versions.
 
Hi, here i am back. I installed a GhostBSD 22.06.18 (SirDice, i hope this is ok) on a Fujitsu E754. During installation, I created the user "toor" for this work. I plugged on the hard drive with the 2tb-file on it. BSD mounted it on /media/da0p1. Then i gave the commands from Alain de Vos via fish:

Code:
mkdir /home/toor/zfsimport
su
cd /media/da0p1
Code:
mdconfig -a -t vnode -f ./zfsfile01
md0
Code:
gpart show -p md0
=>        40  3907029088    md0  GPT  (1.8T)
          40          88         - free -  (44K)
         128     4194304  md0p1  freebsd-swap  (2.0G)
     4194432  3902834696  md0p2  freebsd-zfs  (1.8T)
Code:
zpool import dataset2 -d /dev/gpt/dataset2
cannot import 'dataset2': no such pool available
no matter, which parameter after dataset i set: ./zfsfile01/dataset2, md0/dataset2, md0/md0p2, ... i always get the error: cannot import ....: no such pool avaliable. further tests with
Code:
mdconfig -a -t vnode -f ./zfsfile01
gave to me: md1, md2.

Where i am wrong?? Hm...

I would be very grateful, if you could take a look again.

Thanks a lot.

Alois
 
Thanks covacat, i tried it:
Code:
root@toor-zfs-dfowen:/media/da0p1 # mdconfig -a -t vnode ./zfsfile01 
md3
root@toor-zfs-dfowen:/media/da0p1 # gpart show -p md3
=>        40  3907029088    md3  GPT  (1.8T)
          40          88         - free -  (44K)
         128     4194304  md3p1  freebsd-swap  (2.0G)
     4194432  3902834696  md3p2  freebsd-zfs  (1.8T)

root@toor-zfs-dfowen:/media/da0p1 # zpool import -d /dev
   pool: CorpData
     id: 9425431132159899272
  state: ONLINE
status: The pool was last accessed by another system.
 action: The pool can be imported using its name or numeric identifier and
    the '-f' flag.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-EY
    CorpData ONLINE
    md3p2 ONLINE
Whats should be the next step?
Alois
 
I did now:
Code:
zpool import CorpData -f
No Error. Where did zpool import the CorpData...? maybe i need a mount now...? Oh man ;-)
 
The command results this:
Code:
root@toor-zfs-dfowen:/media/da0p1 # zpool import -d /dev/md0p2
   pool: CorpData
     id: 9425431132159899272
  state: ONLINE
status: Some supported features are not enabled on the pool.
    (Note that they may be intentionally disabled if the
    'compatibility' property is set.)
 action: The pool can be imported using its name or numeric identifier, though
    some features will not be available without an explicit 'zpool upgrade'.
 config:

    CorpData   ONLINE
      md0p2     ONLINE
root@toor-zfs-dfowen:/media/da0p1 #
 
Here is the output of the commands, one after one:

Code:
root@toor-zfs-dfowen:/media/da0p1 # zpool import
   pool: CorpData 
     id: 9425431132159899272
  state: ONLINE
status: Some supported features are not enabled on the pool.
    (Note that they may be intentionally disabled if the
    'compatibility' property is set.)
 action: The pool can be imported using its name or numeric identifier, though
    some features will not be available without an explicit 'zpool upgrade'.
 config:

    CorpData  ONLINE
      md0p2     ONLINE

Code:
root@toor-zfs-dfowen:/media/da0p1 # zpool list -v
NAME        SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
zroot       234G  7.27G   227G        -         -     0%     3%  1.00x    ONLINE  -
  ada0p2    234G  7.27G   227G        -         -     0%  3.10%      -    ONLINE

Code:
root@toor-zfs-dfowen:/media/da0p1 # zfs list
NAME                 USED  AVAIL     REFER  MOUNTPOINT
zroot               7.27G   219G       96K  legacy
zroot/ROOT          7.25G   219G       96K  legacy
zroot/ROOT/default  7.25G   219G     7.25G  /
zroot/tmp            140K   219G      140K  /tmp
zroot/usr           9.87M   219G       96K  /usr
zroot/usr/home      9.59M   219G     9.59M  /usr/home
zroot/usr/ports       96K   219G       96K  /usr/ports
zroot/usr/src         96K   219G       96K  /usr/src
zroot/var            488K   219G       96K  /var
zroot/var/audit       96K   219G       96K  /var/audit
zroot/var/crash       96K   219G       96K  /var/crash
zroot/var/mail       104K   219G      104K  /var/mail
zroot/var/tmp         96K   219G       96K  /var/tmp

Code:
root@toor-zfs-dfowen:/media/da0p1 # ls /dev | grep md | grep p
md0p1
md0p2

Code:
root@toor-zfs-dfowen:/media/da0p1 # zpool import -d /dev/md0p2
   pool: CorpData 
     id: 9425431132159899272
  state: ONLINE
status: Some supported features are not enabled on the pool.
    (Note that they may be intentionally disabled if the
    'compatibility' property is set.)
 action: The pool can be imported using its name or numeric identifier, though
    some features will not be available without an explicit 'zpool upgrade'.
 config:

    CorpData ONLINE
      md0p2     ONLINE

Code:
root@toor-zfs-dfowen:/media/da0p1 # zpool import 9425431132159899272
root@toor-zfs-dfowen:/media/da0p1 #
 
Okay. Yes. This would be the content; but sorry again: i have importet it to /dev - where can i find the objects for cp or tar or something? Sorry, i am a kind of inveterate.
 
with "zfs list" you can see the datasets of the imported zpool.
Mostly they are automatic mounted, if not you you have to do a manual "zfs mount".
You will find the files below the mountpoints.
"zfs list" shows also the mountpoints.
 
Alain De Vos , covacat , PMc , SirDice,
... you are awesome at this board! :)

It workes really good. Finally, i can acces to the sources, i need.
Thanks a really lot, lot, lot for your professional help!
I will recommend this board to others need help!
Have a nice weekend!
Alois
 
Back
Top