Solved How can FreeBSD read and write on the UFS1 file system created by DragonFlyBSD

Each vm is 200GB large. Memory disks ? but how it works ? if you say memory I understand "only read but not write" support. I need to have also write support because I want to use those vms on DFLY,so the changes should be written on the disk.
 
Do it Chad style — write raw images directly to partitions (might require specifically formatted raw images, not sure about details).

can u explain a little bit ? thanks. and if u can,give me some link where I can read more how it works.
 
I see only a solution. The easiest one. To copy the img files in some cloud drive (google drive ? but I have only 100 GB of free space there) and then download them from there. For sure,saving the files to a new hammer2 fs drive,because the drive where I have installed DFLY is not large. The process will take some time and some money.
 
To copy over very large files you don't even need a filesystem in the middle.
It can be a partition large enough without any filesystem.
I forgotten the details : dump,tar ...
Something like
Code:
tar cvf - filename | dd of=/dev/sda1s2 bs=16M
(Or you can also use ntfs and wait two days for the copy to complete.)
 
how many img files can I copy using the tecnique that you have explained ? I have a lot of img files to copy there. And the ntfs fs driver is not mature. I think that I will install a fresh copy of DFLY on the disk where I want to store the img files using hammer2 as fs and then I will zip the img files and I will copy them on my google drive and then I will download and unzip them on the new hammers fs drive that I've just created.
 
I've installed DFLY on the disk that I will use to store the raw-img files,but I've used UFS instead of HAMMER2,because I've thought that I can copy the vms from freebsd to there. Unfortunately it seems that I can't mount that disk from FreeBSD. Do u know why ?

Code:
root@marietto:/home/marietto # mount -t auto /dev/da1p2 /mnt/da1p2
mount: /dev/da1p2: Operation not supported by device

root@marietto:/home/marietto # mount -t ufs /dev/da1p2 /mnt/da1p2      
mount: /dev/da1p2: No such file or directory

root@marietto:/home/marietto # ls /dev/da1*
/dev/da1        /dev/da1p1      /dev/da1p2

=>        63  1953259457  da1p2  MBR  (931G)
          63  1953259457         - free -  (931G)

=>        34  1953525101  diskid/DISK-20130506005976F  GPT  (932G)
34        2014                               - free -  (1.0M)
2048      262144                            1  efi  (128M)
264192  1953259520                            2  dragonfly-label64  (931G)
1953523712        1423                               - free -  (712K)

=>        63  1953259457  gptid/5da2a10d-668a-11ec-9f5e-e1d55ee21f22  MBR  (931G)
63  1953259457                                              - free -  (931G)

=>        63  1953259457  diskid/DISK-20130506005976Fp2  MBR  (931G)
63  1953259457                                 - free -  (931G)
 
I think we need some step-by-step debugging. No, I don't know why things are not working.

root@marietto:/home/marietto # mount -t auto /dev/da1p2 /mnt/da1p2
mount: /dev/da1p2: Operation not supported by device
The error indicates that you tried to do something to a device which the device is not capable of doing. Bizarre examples are things like asking a disk for "eject paper" (yes, such a SCSI command does exit!), or asking a printer to read a disk sector. Obviously, you didn't do these bizarre examples. But the indications here are that you are asking either /dev/da1p2 or /mnt/da1p2 to do something they are not capable of.

Does /dev/da1p2 exist, at this time? If yes, what kind of thing is it? If you do "ls -l" on it, it should have permissions that start with "crw-...", indicating that it is a character device, and you can do read and write on it (I'm assuming you are root when executing that command). If you do "file /dev/da1p2", it should say "character special". If you do "dd if=/dev/da1p2 of=/dev/null bs=1048576 count=1024", to read the first gigabyte of the disk, it should work fine. It's a little harder to check whether it is writeable, but if it weren't, you could try the same mount command with "-o ro", and it should start working. Note that for unusual devices (such as emulated disks in virtualization settings), the permission bits might say "writeable" (as the "crw-..." indicates), but an attempt to write might get either ENODEV (operation not supported by device) or EPERM or EROFS or pretty much any other crazy error number that the implementor of the virtualization layer came up with.

Does /mnt/da1p2 exist? Is it a directory? Is it writeable? Do a "ls -l" on it. Try to create and delete a file in it: "touch /mnt/da1p2/foo" followed by "rm /mnt/da1p2/foo". All that has to work.

I don't like using "-t auto" on the mount command; it forces mount to guess the file system. I would use either "-t ufs", or leave it off, since ufs is the default. But you did that in the next command, leading us to ...

root@marietto:/home/marietto # mount -t ufs /dev/da1p2 /mnt/da1p2
mount: /dev/da1p2: No such file or directory
Was this done at the same time as the command above? Recheck that both /dev/da1p2 and /mnt/da1p2 exist and are the correct type of thing (character device and directory, both writeable).

I assume the next line is from "gpart show /dev/da1":
...
264192 1953259520 2 dragonfly-label64 (931G)
The partition type says that /dev/da1p2 is not a UFS file system, but a DragonFly file system, perhaps Hammer. But that doesn't have to mean that this is what it contains: it is perfectly possible to put data for file system X into a partition that's labelled to be type Y (but a bad idea). You might want to check what data is really in there with "fstyp /dev/da1p2", but I don't know whether that's reliable in detecting DragonFly file systems. You can also try "file -s /dev/da1p2"; again, I know that it will reliably detect UFS when run on FreeBSD, but again, I would not trust it for foreign file systems.

For amusement, here's the output on my system (where the boot disk is known as ada1p2):

# fstyp /dev/ada1p2
ufs
# file -s /dev/ada1p2
/dev/ada0p2: Unix Fast File system [v2] (little-endian) last mounted on /, last written at Sun Dec 26 13:54:12 2021, clean flag 0, readonly flag 0, number of blocks 1572864, number of data blocks 1522519, number of cylinder groups 10, block size 32768, fragment size 4096, average file size 16384, average number of files in dir 64, pending blocks to free 0, pending inodes to free 0, system-wide uuid 0, minimum percentage of free blocks 8, TIME optimization
 
When I have installed the DFLY I've chosen UFS and not HAMMER because I wanted to mount the UFS partition while on FreeBSD. So it should be UFS.
Code:
root@marietto:/dev # file /dev/da1p2   
/dev/da1p2: character special (1/92)

root@marietto:/dev # ls -l /dev/da1p2
crw-r-----  1 root  operator  0x15c 26 dic 21:43 /dev/da1p2

root@marietto:/dev # touch /mnt/da1p2/foo
root@marietto:/dev # rm /mnt/da1p2/foo

root@marietto:/dev # fstyp /dev/da1p2
fstyp: /dev/da1p2: filesystem not recognized

so,it's going to be interesting. DragonFlyBSD during the installation offers to use UFS but it does not seem to be the same UFS used by FreeBSD.
 
Last edited:
Maybe the following commands that I have issued while using DragonFlyBSD will help you to help me more.

Code:
root@marietto:/home/marietto # camcontrol devlist


<SATA CT500MX500SSD4 M3CR>         at scbus1 target 0 lun 0 (da0,sg0,pass0)

<SATA Samsung SSD 860 RVT0>        at scbus2 target 0 lun 0 (da1,sg1,pass1)

<SATA WDC WD3200AAJS-0 01.0>       at scbus3 target 0 lun 0 (da2,sg2,pass2)

<TOSHIBA External USB 3.0 0>       at scbus4 target 0 lun 0 (da8,sg8,pass8)


root@marietto:/home/marietto # gpt show /dev/da8

       start        size  index  contents

           0           1      -  PMBR

           1           1      -  Pri GPT header

           2          32      -  Pri GPT table

          34        2014      -  Unused

        2048      262144      0  GPT part - EFI System

      264192  1953259520      1  GPT part - DragonFly Label64

  1953523712        1423      -  Unused

  1953525135          32      -  Sec GPT table

  1953525167           1      -  Sec GPT header


root@marietto:/mnt # mkdir /mnt/dragonfly-ufs


root@marietto:/mnt # mount -t ufs /dev/da8p1 /mnt/dragonfly-ufs


mount_ufs: /dev/da8p1: No such file or directory


root@marietto:/mnt # ls /dev

acpi        da1s1d        kbd0        pass0        stderr        ttyve        uhid0

ata        da1s1e        kbd1        pass1        stdin        ttyvf        uhid1

bpf        da2        kbd2        pass2        stdout        tun        uhid2

bpf0        da2s0        kbd3        pass8        sysmouse    udev        ums0

bpf1        da2s1        kbd4        pci        tty        udevs        ums1

bpf2        da2s2        klog        ptmx        ttyv0        ugen0.1        upmap

bpf3        da8        kmem        pts        ttyv1        ugen0.2        urandom

bpf4        da8s0        kpmap        random        ttyv2        ugen0.3        usb

console        da8s1        log        serno        ttyv3        ugen0.4        usbctl

consolectl    da8s1a        lpmap        sg0        ttyv4        ugen0.5        vn

crypto        da8s1d        md0        sg1        ttyv5        ugen1.1        vn0

da0        devctl        md0s0        sg2        ttyv6        ugen1.2        vn1

da0s0        devfs        mem        sg8        ttyv7        ugen1.3        vn2

da0s1        dri        midistat    sga        ttyv8        ugen1.4        vn3

da1        dsp        mixer        sgb        ttyv9        ugen1.5        wdog

da1s0        dsp0        mixer0        sgc        ttyva        ugen1.6        xpt0

da1s1        fd        null        sgi        ttyvb        ugen1.7        zero

da1s1a        input        nvmm        slice-by-uuid    ttyvc        ugen1.8

da1s1b        io        part-by-uuid    sndstat        ttyvd        ugen2.1


root@marietto:/mnt # mount -t ufs /dev/da8s1 /mnt/dragonfly-ufs

mount_ufs: /dev/da8s1 on /mnt/dragonfly-ufs: incorrect super block


root@marietto:/mnt # mount -t ufs /dev/da8s1a /mnt/dragonfly-ufs


root@marietto:/mnt # ls /mnt/dragonfly-ufs


boot            boot2            loader            mbr

boot0            boot2_64        loader.conf        modules.local

boot0sio        cdboot            loader.efi        pxeboot

boot1            defaults        loader.help        pxeboot_tftp

boot1.efi        dloader.rc        loader_tftp

boot1_64        kernel            loader_tftp.help
 
this worked on DFLY :

Code:
root@marietto:/ # mount -t ufs /dev/da8s1d /mnt/dragonfly-ufs

Im not sure at all that it works on FreeBSD.
 
I've never used DragonFly, so I have no experience of how it works. Covecat's suggestion is sensible, the old "slice" notation might be what it uses to identify disk partitions. You may have to read some DragonFly documentation to figure out how GPT partitions get mapped to slices, and what the difference between da8s1 and da8s1a is.

And: It's quite possible that what DragonFly calls "UFS" is not not identical to FreeBSD's UFS. I know there are at least three UFS versions in existence, which are mutually slightly incompatible, even though they have common roots: They are in FreeBSD, NetBSD and OpenBSD. No idea which one DragonFly uses.
 
it seems dfly has the same notation for gpt and mbr partitions
so in freebsd will be daXp1[a?]
do a bsdlabel daXp1 in freebsd and post output
 
Code:
root@marietto:/home/marietto # gpart show

=>        63  1953259457  da0p2  MBR  (931G)
          63  1953259457         - free -  (931G)

=>        34  1953525101  diskid/DISK-20130506005976F  GPT  (932G)
34        2014                               - free -  (1.0M)
2048      262144                            1  efi  (128M)
264192  1953259520                            2  dragonfly-label64  (931G)
1953523712        1423                               - free -  (712K)

=>        63  1953259457  gptid/5da2a10d-668a-11ec-9f5e-e1d55ee21f22  MBR  (931G)
63  1953259457                                              - free -  (931G)

=>        63  1953259457  diskid/DISK-20130506005976Fp2  MBR  (931G)
63  1953259457                                 - free -  (931G)

root@marietto:/home/marietto # ls /dev/da0*
/dev/da0        /dev/da0p1      /dev/da0p2

root@marietto:/home/marietto # bsdlabel da0p2
bsdlabel: /dev/da0p2: no valid label found
 
for i in $(jot 256);do echo -n $i;dd if=/dev/da0p2 iseek=$i count=30 2>/dev/null|file -;done|grep -v ": data"

do this from a bourne shell prompt (sh/bash/zsh)
see if you see something about ufs
 
Run sh ... easy, from your csh prompt just say "sh".
Then enter the command that covecat suggested.

Or: Look up how to translate the command into csh syntax. Honestly, I haven't used csh in such a long time, I don't remember, and would have to read the man page.
 
Back
Top