I used hdd for system in Nas4free and this hdd is now system disk for Ubuntu server, but some zfs information is still there...I didnt wipe disk before installing new system. Can I remove this metadata now or I must wipe complete disk and install Ubuntu server again?

enter image description here

enter image description here

1 Answer 1


It's an old question, but just for the records:

The metadata of zfs is stored in the first and last two 256kB of each disk involved in zfs.

So you can do things like this:

sudo dd if=/dev/zero of=/dev/ada1 count=1 bs=512k

for the first bits and after you found the number of all sectors of your device, you can do this for the last metadata bits:

Assuming a sectorsize of 512 bytes, we have

262144 bytes (256kB of metadata) / 512 bytes (sectorsize) = 1024 sectors

sudo dd if=/dev/zero of=/dev/ada1 oseek=NUM_OF_SECTORS-1024

now, you should see a clean device.

Note* - /dev/ada1 is a device in freeBSD. Mounted in Linux it might be /dev/sdb, /dev/hdb etc.

  • 1
    Thanks! It would be better to change oseek to seek as it is synonymous on FreeBSD and doesn't exists on Linux. On Linux, you can go without manual counting with help of blockdev command: sh dd if=/dev/zero of="/dev/sdX1" seek=$(( $(blockdev --getsz "/dev/sdX1") - ( ( 256 * 1024 * 2) / $(blockdev --getpbsz "/dev/sdX1") ) ))
    – Kepi
    Sep 11, 2018 at 11:42
  • @kepi It's appears to me the correct usage of your script on linux is /dev/sdX instead of /dev/sdX1 Jul 5, 2020 at 14:44
  • @fabceolin I believe that /dev/sdX1 is correct as ZFS disk is always partitioned, first partition is for ZFS data - the one we need to remove metadata from. You can check that with wipefs /dev/sdX and wipefs /dev/sdX1 which will show you, that there are no ZFS metadata on /dev/sdX, only partition data.
    – Kepi
    Sep 19, 2020 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .