Gentoo Archives: gentoo-user

From: Wynn Wolf Arbor <wolf@××××××.systems>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Trouble with backup harddisks
Date: Thu, 30 Apr 2020 13:11:10
Message-Id: 20200430131054.4qu3wlayohodrreu@nabokov.fritz.box
In Reply to: Re: [gentoo-user] Trouble with backup harddisks by Wols Lists
1 Hi,
2
3 On 2020-04-30 13:17, Wols Lists wrote:
4 >All I can suggest is to check the kernel and see if it's an option that
5 >has been disabled (512-byte sectors, that is).
6
7 As far as I know the kernel still uses 512 bytes internally [1], and I
8 do not recall having seen an option that enables or disables support for
9 512/4K sectors.
10
11 That said, the problem may well be stemming from a sector size
12 discrepancy, but as I understand it, it would have to do with how and
13 when the partition table was created. That is, like described in [2],
14 some USB enclosures seem to be a bit overzealous with obscure features,
15 and might take eight disk sectors and bundle them together into one 4K
16 sector.
17
18 If the disk was partitioned in the exact same enclosure, and is read
19 from the exact same enclosure right now, there shouldn't be any
20 problems. Is this the case, Meino?
21
22 Also, when did you last access the drives successfully, and with which
23 system?
24
25 On 2020-04-30 11:32, Meino wrote:
26 > Disk /dev/sdb: 931.49 GiB, 1000170586112 bytes, 1953458176 sectors
27 > Disk model: Elements 25A2
28 > Units: sectors of 1 * 512 = 512 bytes
29 > Sector size (logical/physical): 512 bytes / 512 bytes
30 > I/O size (minimum/optimal): 512 bytes / 512 bytes
31 >
32 > Disklabel type: dos
33 > Disk identifier: 0x16f2a91f
34 >
35 > Device Boot Start End Sectors Size Id Type
36 > /dev/sdb1 1 1953458175 1953458175 931.5G ee GPT
37
38 Interestingly, this reads *exactly* like the Protective MBR [3] that GPT
39 has. That is, the disklabel type is DOS whilst the partition ID is EE.
40 There's a single partition that spans the entire drive (and it's also
41 seemingly not aligned properly - usually you see Start at 2048).
42
43 As a comparison, here's the output from fdisk for the Protective MBR
44 from one of my GPT drives:
45
46 > Disklabel type: dos
47 > Disk identifier: 0x00000000
48
49 > Device Boot Start End Sectors Size Id Type
50 > /dev/sdc1 1 4294967295 4294967295 2T ee GPT
51
52 I'd assume that the missing disk identifier here is coming from
53 different tools writing the protective MBR differently.
54
55 With that said, are you absolutely certain that you did not partition
56 this drive with GPT instead of MBR? Did you do the partitioning in
57 something like fdisk (which asks you specifically what you want), or
58 some other application? Did you maybe format this drive on a Windows
59 system?
60
61 I'm not one to discount entirely strange things happening, but I have
62 never before seen a proper MBR laid out like a protective MBR. Indeed it
63 would be quite impossible to have systems access data through such a
64 table, since the partitions are hidden within that one huge contiguous
65 block.
66
67 Ordinarily I'd point to fdisk not reading the partition table properly,
68 but it seems that although your kernel has support for GPT, it doesn't
69 seem to see the partitions either (assuming a proper GPT exists at all).
70 Do you have some other GPT drives you can access successfully?
71
72 I'd say that this requires some more forensic work. Perhaps extracting
73 the first few megabytes of the disk and seeing whether there's a proper
74 GPT or not. This would of course require manual work.
75
76 A few more things to try:
77
78 To see what the kernel uses for a particular disk, you can run the
79 following: cat /sys/block/sdb/queue/{physical,logical}_block_size
80
81 fdisk takes a sector size with -b, --sector-size (should be
82 non-destructive as long as you don't write anything, but I am not sure).
83 Also, fdisk has a compatibility mode for dos with -c=dos. Might be worth
84 a short.
85
86 fdisk should support GPT starting with util-linux 2.23, but you can also
87 try gptfdisk (it's in the tree).
88
89 Hope this helps.
90
91 [1] https://github.com/torvalds/linux/blob/master/include/linux/types.h#L120
92 [2] https://superuser.com/questions/679725/how-to-correct-512-byte-sector-mbr-on-a-4096-byte-sector-disk/679800#679800
93 [3] https://en.wikipedia.org/wiki/GUID_Partition_Table#PROTECTIVE-MBR
94
95 --
96 Wolf

Replies

Subject Author
Re: [gentoo-user] Trouble with backup harddisks tuxic@××××××.de