Is there a way to save my drive? (Je suis dans la merdeā¦)
0. Before the accident
Before that stupid amateur error, the following commands output my previous ādisk stateā:
nfg@coco:~/temp$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.8
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1953525167 sectors, 931.5 GiB
Model: Expansion
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): AB88A2E1-5B2D-40C5-BE22-436DC27B5582
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525133
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB EF00 EFI System Partition
2 1050624 5244927 2.0 GiB 8200
3 5244928 9439231 2.0 GiB BE00
4 9439232 1953525133 927.0 GiB BF00
nfg@coco:~/temp$ sudo blkid /dev/sda2
/dev/sda2: UUID="41f51b83-daae-4680-aa1d-e6ba7de1a0b1" TYPE="crypto_LUKS" PARTUUID="eb860651-953a-6542-8a98-5453509b8c4f"
nfg@coco:~/temp$ sudo blkid /dev/sda3
/dev/sda3: LABEL="bpool" UUID="1983260328483891507" UUID_SUB="2280284370650918900" BLOCK_SIZE="4096" TYPE="zfs_member" PARTUUID="daec9167-7629-e54b-85d1-8d7995a9f35c"
nfg@coco:~/temp$ sudo blkid /dev/sda4
/dev/sda4: LABEL="rpool" UUID="11453632911775052663" UUID_SUB="12417951916163988317" BLOCK_SIZE="4096" TYPE="zfs_member" PARTUUID="47bedec4-6433-4b4e-8b55-35765f9bbfe7"
1. The fatal error
sudo zpool create -f arachXXX /dev/sda
ā¦ oups!
2. Is it possible to rollback?
Now my drive look like this, and I want to know if itās possible to repareā¦
nfg@coco:~$ sudo gdisk -l /dev/sda
[sudo] Mot de passe de nfg :
GPT fdisk (gdisk) version 1.0.8
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1953525167 sectors, 931.5 GiB
Model: Expansion
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 22ED8AD5-96F2-5544-979B-153237CD9C9E
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525133
Partitions will be aligned on 2048-sector boundaries
Total free space is 3436 sectors (1.7 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1953507327 931.5 GiB BF01 zfs-5ff1ad3692280185
9 1953507328 1953523711 8.0 MiB BF07
Any idea?
Pleaseā¦ I need help (je suis vraiment dans la merdeā¦)
You should be able to use disk to delete the new partitions and recreate them as they were. The EFI system partition is likely damaged beyond repair. The others may or may not have been damaged. If they have a filesystem on them, see if fsck can repair them.
Emphasize - create a new partition table and recreate the old partitions WITHOUT FORMATTING THE PARTITIONS. If the data is still there, you may be able to import the pools, but there is no guarantee.
@mgerdts these are ZFS pools, there is no fsck for ZFS. An import and scrub may perform some repairs if possible.
nfg@coco:~$ zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
arachide 928G 164K 928G - - 0% 0% 1.00x ONLINE -
nfg@coco:~$ sudo zpool export arachide
[...]
Itās seem to take a long timeā¦ is that normal?
May I kill ^C the process? (Waiting for answers before doing anything else: I will follow your wise advices step by stepā¦)
Yes Sir!
After that, I will test to:
RECREATE OLD PARTITIONS,
WITH THE EXACT START AND END SECTORS NUMBERS
GPT fdisk (gdisk) version 1.0.8
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1953525167 sectors, 931.5 GiB
Model: Expansion
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): AB88A2E1-5B2D-40C5-BE22-436DC27B5582
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525133
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB EF00 EFI System Partition
2 1050624 5244927 2.0 GiB 8200
3 5244928 9439231 2.0 GiB BE00
4 9439232 1953525133 927.0 GiB BF00
If your pool is actually available right now, Iād back up all the data before trying anything else.
In theory, just recreating the partition table will be enough to save it. But in practiceā¦ yeah, like I said, if the pool is actually online and mounted the first thing Iād be doing is trying to replicate the data off from it, then try the fancy tricks to bring it back to life in-place, but know that if they go wrong, at least Iāve still got all my data.
So, thatās the plan (in theory): the old table was:
nfg@coco:~/temp$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.8
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1953525167 sectors, 931.5 GiB
Model: Expansion
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): AB88A2E1-5B2D-40C5-BE22-436DC27B5582
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525133
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB EF00 EFI System Partition
2 1050624 5244927 2.0 GiB 8200
3 5244928 9439231 2.0 GiB BE00
4 9439232 1953525133 927.0 GiB BF00
nfg@coco:~/temp$ sudo blkid /dev/sda2
/dev/sda2: UUID="41f51b83-daae-4680-aa1d-e6ba7de1a0b1" TYPE="crypto_LUKS" PARTUUID="eb860651-953a-6542-8a98-5453509b8c4f"
nfg@coco:~/temp$ sudo blkid /dev/sda3
/dev/sda3: LABEL="bpool" UUID="1983260328483891507" UUID_SUB="2280284370650918900" BLOCK_SIZE="4096" TYPE="zfs_member" PARTUUID="daec9167-7629-e54b-85d1-8d7995a9f35c"
nfg@coco:~/temp$ sudo blkid /dev/sda4
/dev/sda4: LABEL="rpool" UUID="11453632911775052663" UUID_SUB="12417951916163988317" BLOCK_SIZE="4096" TYPE="zfs_member" PARTUUID="47bedec4-6433-4b4e-8b55-35765f9bbfe7"
Step #1 ā Manualy recreate the global partitionās table with gfdisk
Disk identifier (GUID) = AB88A2E1-5B2D-40C5-BE22-436DC27B5582
Partions 1, 2, 3 and 4:
Start (sector)
End (sector)
Code
Name (only for sda1 with āEFI System Partitionā)
The result is:
nfg@coco:~$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.8
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1953525167 sectors, 931.5 GiB
Model: Expansion
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): AB88A2E1-5B2D-40C5-BE22-436DC27B5582
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525133
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB EF00 EFI System Partition
2 1050624 5244927 2.0 GiB 8200
3 5244928 9439231 2.0 GiB BE00
4 9439232 1953525133 927.0 GiB BF00
Step #2 ā Work in progressā¦ (see you tomorrow)
I wish you luck. I canāt add anything to your plan.
(I didnāt reply earlier because we were out of town to see the solar eclipse that crossed North America yesterday. If you get a chance to watch the one that crosses Spain in 2026 I highly recommend it.)