I recently made a silly mistake. I was looking a TRUEOS DVD and I thought it was a live system, but it was an install DVD. It wrote a ZFS filesystem all over my 500Gb SSD… wiped everything, even grub on the MBR.
Fortunately I had clonezilla backups. They were saveparts
images - ie images of partitions.
So I had to put the partitions back before I could restore filesystems. I did that with gparted
…made a GPT partition table and created 7 partitions … EFISystem, bios-boot, 4 x ext4 partitions, and a swap partiton.
Went ahead with clonezilla and restored my Debian filesystem and my data filesystem.
Then I had to install grub. Used SystemRescueCD
for that.
Also had to remove grub.cfg from the Debian filesystem, because I had reinstalled Debian to a different partition.
Also had to edit /etc/fstab
to fix the UUID’s
Then I could reboot and get the grub>
prompt. From there I booted Debian with
grub> linux /vmlinuz root=/dev/sda4 grub> initrd /initrd.img grub> boot
And Debian booted . So then from within Debian I could configure grub with update-grub
.
Then a reboot showed that i had a grub menu and could boot from that.
OK success … so I thought. But
- it took forever to boot
- when I looked at the disk from within Debian, with the
Gnome-disk-utility
, it looked normal, but when I looked withgparted
it said the entire disk was one ZFS partition!
What is going on? There must be some residue of ZFS on the disk?.. much research, and I finally find a tool called wipefs
which I can use to check the disk.
Now, wipefs
sounds like a dangerous tool, and it is, so another clonezilla backup first.
Then do this
root@mary:/home/nevj# wipefs /dev/sda DEVICE OFFSET TYPE UUID LABEL sda 0x7dc00 zfs_member sda 0x7d400 zfs_member sda 0x7d000 zfs_member sda 0x7cc00 zfs_member sda 0x7c800 zfs_member sda 0x7c400 zfs_member sda 0x7c000 zfs_member sda 0x7bc00 zfs_member .............. ............. sda 0x67800 zfs_member sda 0x67400 zfs_member sda 0x67000 zfs_member sda 0x66c00 zfs_member sda 0x200 gpt sda 0x6fc86d5e00 gpt sda 0x1fe PMBR root@mary:/home/nevj#
It lists many items that are called signatures
… most of them zfs_member, but at the end my GPT partition table, another copy of the GPT partition table at the top of the disk, and the PMBR (protective MBR).
We can use wipefs
to remove these zfs signatures as follows
root@mary:/home/nevj# wipefs -o 0x7dc00 /dev/sda wipefs: error: /dev/sda: probing initialization failed: Device or resource busy
but, hang on, the disk is mounted and it can not do it from within Debian
So back to SystemRescueCD
, and do from there
wipefs -o 0x7dc00 /dev/sda ...... wipefs -o 0x66c00 /dev/sda
Yes I had to type the whole 90 lines of wipefs...
without mistake.
Reboot Debian, and it is right. Boot is now normal speed, and gparted finds my 7 partitions now. Do another backup .
I just thought this story might be interesting. Anyone can make a mistake. Recovering is not always easy … and is impossible if you do not have a backup…
I quote @Akito “Always do a backup”
Cheers
Neville