Gentoo Archives: gentoo-user

From: John Blinka <john.blinka@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] zfs repair needed (due to fingers being faster than brain)
Date: Mon, 01 Mar 2021 22:25:24
Message-Id: CAC_tCmp4zO1DVYiPQm+Y_Y+ezp+901Qth2d5pi6KY2zs20q52g@mail.gmail.com
1 HI, Gentooers!
2
3 So, I typed dd if=/dev/zero of=/dev/sd<wrong letter>, and despite
4 hitting ctrl-c quite quickly, zeroed out some portion of the initial
5 part of a disk. Which did this to my zfs raidz3 array:
6
7 NAME STATE READ WRITE CKSUM
8 zfs DEGRADED 0 0 0
9 raidz3-0 DEGRADED 0 0 0
10 ata-HGST_HUS724030ALE640_PK1234P8JJJVKP ONLINE 0 0 0
11 ata-HGST_HUS724030ALE640_PK1234P8JJP3AP ONLINE 0 0 0
12 ata-ST4000NM0033-9ZM170_Z1Z80P4C ONLINE 0 0 0
13 ata-ST4000NM0033-9ZM170_Z1ZAZ8F1 ONLINE 0 0 0
14 14296253848142792483 UNAVAIL 0 0
15 0 was /dev/disk/by-id/ata-ST4000NM0033-9ZM170_Z1ZAZDJ0-part1
16 ata-ST4000NM0033-9ZM170_Z1Z80KG0 ONLINE 0 0 0
17
18 Could have been worse. I do have backups, and it is raid3, so all
19 I've injured is my pride, but I do want to fix things. I'd
20 appreciate some guidance before I attempt doing this - I have no
21 experience at it myself.
22
23 The steps I envision are
24
25 1) zpool offline zfs 14296253848142792483 (What's that number?)
26 2) do something to repair the damaged disk
27 3) zpool online zfs <repaired disk>
28
29 Right now, the device name for the damaged disk is /dev/sda. Gdisk
30 says this about it:
31
32 Caution: invalid main GPT header, but valid backup; regenerating main header
33 from backup!
34
35 Warning: Invalid CRC on main header data; loaded backup partition table.
36 Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
37 on the recovery & transformation menu to examine the two tables.
38
39 Warning! Main partition table CRC mismatch! Loaded backup partition table
40 instead of main partition table!
41
42 Warning! One or more CRCs don't match. You should repair the disk!
43 Main header: ERROR
44 Backup header: OK
45 Main partition table: ERROR
46 Backup partition table: OK
47
48 Partition table scan:
49 MBR: not present
50 BSD: not present
51 APM: not present
52 GPT: damaged
53
54 Found invalid MBR and corrupt GPT. What do you want to do? (Using the
55 GPT MAY permit recovery of GPT data.)
56 1 - Use current GPT
57 2 - Create blank GPT
58
59 Your answer: ( I haven't given one yet)
60
61 I'm not exactly sure what this is telling me. But I'm guessing it
62 means that the main partition table is gone, but there's a good
63 backup. In addition, some, but not all disk id info is gone:
64 1) /dev/disk/by-id still shows ata-ST4000NM0033-9ZM170_Z1ZAZDJ0 (the
65 damaged disk) but none of its former partitions
66 2) /dev/disk/by-partlabel shows entries for the undamaged disks in the
67 pool, but not the damaged one
68 3) /dev/disk/by-partuuid similar to /dev/disk/by-partlabel
69 4) /dev/disk/by-uuid does not show the damaged disk
70
71 This particular disk is from a batch of 4 I bought with the same make
72 and specification and very similar ids (/dev/disk/by-id). Can I
73 repair this disk by copying something off one of those other disks
74 onto this one? Is repair just repartitioning - as in the Gentoo
75 handbook? Is it as simple as running gdisk and typing 1 to accept
76 gdisk's attempt at recovering the gpt? Is running gdisk's recovery
77 and transformation facilities the way to go (the b option looks like
78 it's made for exactly this situation)?
79
80 Anybody experienced at this and willing to guide me?
81
82 Thanks,
83
84 John Blinka

Replies

Subject Author
Re: [gentoo-user] zfs repair needed (due to fingers being faster than brain) antlists <antlists@××××××××××××.uk>
Re: [gentoo-user] zfs repair needed (due to fingers being faster than brain) Grant Taylor <gtaylor@×××××××××××××××××××××.net>