Total sectors field in MBR partition entry is 32 bits in length. This means that in case of 512 byte sector size, the maximum partition size is 2^32*512/10^12 TB. Am I correct that in case of 4Kn disks the maximum partition entry size is 2^32*4096/10^12, i.e. 17.59TB? If yes, then this would mitigate the need for GPT?
Hard Drive Partitioning – Maximum Partition Size for 4Kn Disks with MBR
hard drivepartitioning
Related Solutions
It's a little late, but I had a similar problem after the USB port of my IOMEGA hard disk case broke off. I switched to another USB-2-SATA case just to discover, that I could not mount the EXT4 partition. For some reason the IOMEGA case reported the logical sector size to be 4096, but my new case said it was only 512 bytes. This screws up the MS-DOS partitioning table.
It was driving me nuts, because with the help of testdisk
I was able to access the partition, when changing the sector size, but I found no way to change the sector size system-wide. It turns out, that's not necessary, because EXT4 does not care for sector size, you just have to find the beginning of the partition you'd like to access.
Quick fix: Use a loopback device to shift to the correct position of the partition.
Permanent fix: Rewrite partition table, accordingly.
In my case the affected drive was /dev/sdb
.
My quick fix was relatively easy, since I had only one partition beginning at sector 63.
$ sudo sfdisk -d /dev/sdb
# partition table of /dev/sdb
unit: sectors
/dev/sdb1 : start= 63, size=623708785, Id=83
Now we have to calculate the partition's position, when sector size still was 4096 bytes:
63 sectors * 4096 bytes = 258048 bytes
And use that with losetup
:
$ sudo losetup /dev/loop0 /dev/sdb -o 258048
$ sudo mount /dev/loop0 /mnt
Your partition should now be mounted at /mnt
.
For the longterm fix I used sfdisk
to dump the partition layout:
$ sudo sfdisk -d /dev/sdb > sdb.partitions.sfdisk.text
Fixing the partition table by multiplying with the beginning sector with 8 where appropriate -- here I realized my partition table was kinda screwed from the beginning.
I edited the partition table dump with nano sdb.partitions.sfdisk.text
:
/dev/sdb1 : start= 63, size=623708785, Id=83
to:
/dev/sdb1 : start= 504, size=623708785, Id=83
and later on extended the partition to use all available space (which I determined by other means):
/dev/sdb1 : start= 504, size=625141944, Id=83
Last step is to write back the partition table with:
$ sudo sh -c 'cat sdb.partitions.sfdisk.text | sfdisk /dev/sdb'
Many Western Digital external USB drives over 2 TB (including at least some My Book, My Book Essential, Elements, and Easystore drives) can be configured for either 512 byte logical sectors or 4096 byte logical sectors using the WD Quick Formatter tool. When configured for 4096 byte logical sectors, the USB-to-SATA bridge in the enclosure does a translation between 512 byte logical sectors at the SATA interface to the internal drive and 4096 byte logical sectors at the USB interface to the host computer.
With 512 byte logical sectors, an MBR partition table could only use up to 2 TB of a drive. That's because MBR table entries are 32 bits with a max of 2^32 or 4,294,967,296 sectors. 2^32 sectors x 512 bytes/sector is 2 TB. With 4096 byte logical sectors, an MBR partition cable can use up to 16 TB of a drive. (2^32 sectors x 4096 bytes/sector is 16 TB) Windows XP only supports MBR partition tables, and so 4096 byte logical sectors are the only way to use all of the space on a drive over 2 TB in Windows XP. The newer GPT partition table format supported in Windows Vista and later does not have the 32-bit limitation, and can support disks larger than 2 TB regardless of the sector size.
The WD Quick Formatter tool (version 2.0.0.65 available for download as of this writing) can enable or disable the sector size translation. This version of the tool does not work correctly under Windows XP, so I recommend running the tool in Windows 7 or later. When run in Windows 7, or in later version of Windows but with Windows 7 compatibility mode, the tool will present two configuration options on the "Format your WD external drive" screen:
- XP Compatible: This option configures the drive for 4096 byte logical sectors, and creates an MBR partition table.
- Most Compatible (Vista or later required): This option configures the drive for 512 byte logical sectors, and creates a GPT partition table.
Both options also create a single partition filling the entire drive, and quick format it in NTFS.
If you run the tool in Windows 8 or later without putting it in Windows 7 compatibility mode, the tool will not present a compatibility option on the formatting screen and it will format in the "most compatible" mode (512 byte logical sectors).
WD Quick Formatter 2.0.0.65 doesn't work correctly in Windows XP: it successfully configures 4096 byte logical sectors, but fails to format correctly. Another tool can subsequently be used to partition and format the drive.
WD Quick Formatter 1.2.0.10 works correctly in Windows XP, but is not available for download from Western Digital anymore.
When the target drive is configured for the same logical sector size as the source, you can copy to it using dd and the copy will work without any need to alter the partition table.
I can confirm that these Western Digital external USB drives can be configured for XP compatibility:
Easystore 14 TB (WDBCKA0140HBK)
Easystore 12 TB (WDBCKA0120HBK)
Easystore 8 TB (WDBCKA0080HBK)
My Book Essential 1140, 3 TB (WDBACW0030HBK)
Elements 1021, 3 TB (WDBAAU0030HBK)
Best Answer
Yes, if the sector size is actually 4 KiB, the maximum MBR partition size will be 16 TiB. (By the
i
s in those units I mean the power-of-1024 definition, of which the everyday power-of-1000 definition is an approximation.)The size of an MBR partition is determined by the address of its first sector and its length in sectors, which are stored in the partition table. See the format at Wikipedia. Originally, sectors were named in Cylinder-Head-Sector (CHS) style, but that limited the disk to 224 sectors (because the CHS address was stored in a three-byte field). Since that was a real shame, Logical Block Addressing - as alluded to in this Microsoft article - was adopted. LBA sector addresses and the sector count are stored in four-byte fields, and (according to the Microsoft Windows 2000 Server Operations Guide) if these fields are present, OSes ignore the CHS fields. Note that the original ATA spec (not the MBR partition table records) only supported 28-bit sector addresses, so that's why you hear about smaller limits on old systems.
After a while, it was realized that a sector size of 512 bytes was a real downer because of this whole 2 TiB limit. For that and ECC/integrity reasons, the Advanced Format appeared (see here for more technical stuff). Drives that physically have 4KiB sectors will present themselves to the OS in one of two modes, 512e or 4Kn, usually depending on their jumper configuration. The
e
in 512e stands for emulation - it pretends that its sector size is only 512 bytes, and does some adjustment called read-modify-write when the OS gives it an updated sector. Read more about RMW in this Microsoft article. In 4Kn (n
for native) mode, the drive assumes the OS understands 4KiB sectors and reports the real sector size in the disk geometry. On Windows, you can runfsutil fsinfo ntfsinfo
followed by a drive letter to see the Bytes Per Physical Sector (real sector size) and the Bytes Per Sector (presented sector size). As of Windows 8, Windows supports native 4KiB sectors. You will only be able to use the extra space in 4Kn mode, since the OS knows nothing about the big sectors in 512e mode and therefore can't think about data beyond 2 TiB.Since 4Kn multiplies the sector size by 8, the maximum partition size (which, again, is defined in terms of sectors) is multiplied by 8 to produce 16 TiB. That applies only to actual partitions; Windows has allowed larger volumes for a long time, which you can create with RAID. I'm sure other OSes have similar functionality. Do be careful, though, as naive disk formatters may refuse to create an MBR partition bigger than 2 TiB if the limitation is hard-coded.
All that said, GPT gives you nice things like being able to have more than four real partitions on one disk and some extra resiliency. You should switch to GPT.