Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The plot

I have a WD10JPVT 1Tb disk inside an IcyBox IB-290StUS-B USB/esata enclosure.

  • When I connect the disk via USB, I get a 512 logical / 512 physical sector size.
  • When I connect the disk via the computer's native esata port, I get a 512 logical / 4k physical sector size.
  • When I connect the disk via an AKE Hidden USB 3.0 + eSATA II ExpressCard 54mm's esata port, I get a 4k logical / 4k physical sector size.

The problem

The problem is that in a MBR partition table, the beginning and end of partitions is expressed as a number of (logical) sectors. This means that if I partition the disk when it is plugged via the expresscard's esata port, and then plug it in a USB port or the native esata port, the partitions will have a wrong offset and wrong size, and vice-versa.

fdisk output

The fdisk commands below are run using Ubuntu 11.04 (natty), and give the same results with XUbuntu 12.04 for the USB and esata on expresscard, but I can't test native esata since that's what I boot Ubuntu 12.04 from.

Connected via USB:

> sudo fdisk -l /dev/sdb
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c2664

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       15201   122095104    7  HPFS/NTFS

Connected via the computer's native esata port:

> sudo fdisk -l /dev/sdb
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000c2664

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       15201   122095104    7  HPFS/NTFS

Connected via the expresscard's esata port:

> sudo fdisk -l /dev/sdb
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 15200 cylinders
Units = cylinders of 16065 * 4096 = 65802240 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000c2664

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       15201   976760832    7  HPFS/NTFS

Solutions ?

  • Is there a way to store the "real" sector size (4k) inside an MBR partition table ?
  • Using a GPT partition table might have worked, but the GPT header is stored in sector 1 of the disk… and the sector size varies, so unless there is a way to store the GPT header at a fixed position measured in bytes, it's useless.
  • Formatting the raw drive without any partition works, but under ubuntu 11.04 I have to manually mount the disk (/dev/sdb), since Hal tries to mount the non-existant partitions (/dev/sdb1, /dev/sdb2, …), despite the fact it detects the filesystem label correctly.
  • I can create manually two overlapping partitions, one which works with 4k sectors, and one which works with 512 sectors, and every time I plug the disk one partition will be invalid and the other will be used, but this feels ugly and brittle.
share|improve this question
    
Self-comment : this SU question is very similar, but might be a problem with the enclosure not supporting large drives, and is a problem between usb and esata. My problem here is between usb/native esata on one side, and expresscard esata on the other. –  Georges Dupéron Oct 13 '12 at 22:02
    
Note that GPT partition locations are also expressed in logical sectors. You could try to create a layout with two instances of GPT and a small number of partition entries, so that 512b and 4K instances do not actually overlap (create a 4K one first, then create a 512b one which fits in the 4K-512b hole), but this technically violates the GPT spec and therefore may not work with some OS versions. –  Sergey Vlasov May 12 '13 at 20:14
    
The usb disk has internal sector size of 4K but pretends to different sector sizes according to the port. I would suggest formatting as GPT rather than the oldish MBR - gdisk instead of fdisk. See also this article. Do it via the ExpressCard as being the most advanced, then check if it still works for the other ports, even if they will use the Legacy MBR. –  harrymc May 13 '13 at 6:21
    
@harrymc, unless I misunderstand you, this will not work. The legacy mbr just holds a single partition, which covers the whole gpt-partitionned space. But the gpt table itself is located in sector 1, whose position changes depending upon the sector size. –  Georges Dupéron May 13 '13 at 11:24
1  
I am astonished to find out that the problem of variable-sized logical sectors is not supported by the GPT & MBR standards. I have added my answer, which is unfortunately negative. –  harrymc May 13 '13 at 16:04
show 1 more comment

1 Answer

up vote 1 down vote accepted
+50

You have done a very deep analysis of disk formats, both MBR and GPT, and it seems that you have hit a problem that was unthought-of in these standards, that of a format that is independent of the logical sector size.

The problem is that the USB disk has internal sector size of 4K but pretends to different sector sizes (both logical and physical) according to the port to which it is connected. In practice, it also pretends to different cylinder/sector configurations, although this mapping is at least consistent.

Changing this behavior will require either :

  1. Changes in the disk firmware
  2. Changing the protocol used on the port, meaning changes in the disk driver used for the USB disk

Both these options seem to me to be impossible to do yourself. I have not found on the Western Digital site any firmware updates for your disk, and I have not searched for better disk drivers (partly because I don't know what exactly to search for, but even if I knew I wouldn't be too optimistic).

The same question was asked on the following post, dating from June 2012,
How would I force Debian to use the physical sector size on a hard disk?

This is the unencouraging accepted answer (which quotes an article from July 2011) :

According to an interview with a Western Digital representative published on http://www.techarp.com/showarticle.aspx?artno=734 there is no option to disable 512e emulation on current Advanced Format drives.

[...] will Western Digital offer firmware upgrades that would convert current Advanced Format drives running in emulation mode, to the native format?

Unfortunately, no. Current Advanced Format drives cannot be converted to run in the native format through a firmware upgrade

I hope someone else comes up with a better answer, but my own answer tends to be negative. I wouldn't advice trying to fabricate a non-standard GPT/MBR format, not if you wish to keep your data safe.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.