Solved dump(8) keeps giving "unknown file system" when cloning partition

I would like to migrate a virtual machine's filesystem onto a smaller virtual disk using dump(8).
I have tried both using the 12.1-RELEASE installer in live CD mode, and also attaching the disks to a separate VM running 12.0-RELEASE, but dump(8) keeps failing on me with "unknown file system".

I try to follow the steps mentioned in the disk FAQ here: https://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#idp48962936

Both filesystems are created using newfs -U, i.e. soft-updates without journaling (I have double-checked using tunefs(8)), and I mount them onto mountpoints under /mnt with the options rw,noatime:
Code:
# mount -t ufs -o rw,noatime /dev/vtbd1p2 /mnt/old
# mount -t ufs -o rw,noatime /dev/vtbd2p2 /mnt/new

The source partition (/mnt/old) seems to be mounted correctly:
Code:
# df -h /mnt/old
Filesystem      Size    Used   Avail Capacity  Mounted on
/dev/vtbd1p2     54G     22G     28G    43%    /mnt/old
Code:
# mount | grep old
/dev/vtbd1p2 on /mnt/old (ufs, local, noatime, soft-updates)

However, I keep getting this error:
Code:
# cd /mnt/new
# dump 0af - /mnt/old/ | restore rf -
dump: /mnt/old/: unknown file system
Tape is not a dump tape

Adding -L does not make a difference, it just tells me that it cannot be used on an unmounted filesystem:
Code:
# dump 0aLf - /mnt/old/ | restore rf -
  DUMP: WARNING: Cannot use -L on an unmounted filesystem.
dump: /mnt/old/: unknown file system
Tape is not a dump tape

What am I doing wrong? I'm pretty sure I have used dump(8) for this purpose in the past, but I might be wrong.
Should I be using dump(8) on the unmounted raw partition (i.e. /dev/vtbd1p2) instead?
 
under livecd you can't write under /mnt it's read only so you can't create mount points there.
use /tmp instead if you want to mount it or better not mount it at all. It's not needed for the source.

p.s.
you will need writable TMPDIR for the restore and you will need to recreate the swap and boot partition on the new disk.
 
under livecd you can't write under /mnt it's read only so you can't create mount points there.
use /tmp instead if you want to mount it or better not mount it at all. It's not needed for the source.

p.s.
you will need writable TMPDIR for the restore and you will need to recreate the swap and boot partition on the new disk.
Thanks! It worked when using the device file rather than the mountpoint: dump -C32 -b64 -0uan -f - /dev/vtbd1p2 | (cd /mnt/new && restore -ruf -)

I noticed the following in dump(8):
The file system to be dumped is specified by the argument filesystem as either its device-special file or its mount point (if that is in a standard entry in /etc/fstab).
Which means that it uses /etc/fstab to lookup the block device based on the mountpoint. This explains why it didn't work for my temporary mount points in /mnt, but had been working for me in the past when backing up / and other fixed mounts specified in fstab(5). :)
 
Back
Top