Large external USB with wrong capacity

Hello,

I was using an 1.5TB external drive connected to my OSMC, but it is almost full. So I bought a new HDD, with 8TB capacity.
To my surprise when I replaced the two HDDs OSMC saw only ~1.3TB in fdisk and in parted also.

fdisk header:
Command (m for help): p
Disk /dev/sda: 1.3 TiB, 1404493455360 bytes, 2743151280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

I attached this new HDD (still via USB 2.0) to my Win7 desktop, and it also saw as ~1.3TB. I started to worry so I connected the HDD to this win7 PC via SATA and the PC saw the full 8TB…
While it was this way I formatted the HDD for the whole partition (as NTFS) and a 7.3TB partition (drive E:) appeared. I put back the drive into the external USB enclosure and attached it back to my win7 PC via USB. To my surprise the win7 machine saw this drive as 7.3TB drive…
But. When I attached it again to my raspberryPI (running OSMC) it still saw 1.3TB (with incorrect partition table):
Disk /dev/sda: 1.3 TiB, 1404493455360 bytes, 2743151280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2D48D475-5139-44FD-9082-FEE7D44A1CF0

Device      Start         End     Sectors  Size Type
/dev/sda1      34      262177      262144  128M Microsoft reserved
/dev/sda2  264192 15628052479 15627788288  7.3T Microsoft basic data

fdisk complained to the invalid part table (end of partition exceeds the disk’s capacity)…

Output of lsusb:
Bus 001 Device 007: ID 152d:2336 JMicron Technology Corp. / JMicron USA Technology Corp. Hard Disk Drive

Logs from dmesg:
[330695.762885] usb 1-1.3: new high-speed USB device number 7 using dwc_otg
[330695.894864] usb 1-1.3: New USB device found, idVendor=152d, idProduct=2336
[330695.894884] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=5
[330695.894898] usb 1-1.3: Product: JM20336 SATA, USB Combo
[330695.894908] usb 1-1.3: Manufacturer: JMicron
[330695.894918] usb 1-1.3: SerialNumber: C0E888888888
[330695.896767] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[330695.900359] scsi host0: usb-storage 1-1.3:1.0
[330696.924212] scsi 0:0:0:0: Direct-Access ST8000DM 004-2CX188 PQ: 0 ANSI: 2 CCS
[330696.925782] sd 0:0:0:0: Attached scsi generic sg0 type 0
[330696.925893] sd 0:0:0:0: [sda] 2743151280 512-byte logical blocks: (1.40 TB/1.28 TiB)
[330696.926792] sd 0:0:0:0: [sda] Write Protect is off
[330696.926821] sd 0:0:0:0: [sda] Mode Sense: 00 38 00 00
[330696.927704] sd 0:0:0:0: [sda] Asking for cache data failed
[330696.927744] sd 0:0:0:0: [sda] Assuming drive cache: write through
[330696.992492] sda: sda1
[330696.996169] sd 0:0:0:0: [sda] Attached SCSI disk

Does anyone have any idea why does it work under win7 (64bit) and why doesn’t it under OSMC?

Thanks!

Can you try another enclosure?

Unfortunately I don’t have any other. I guess it is the fault of the enclosure (some limit in the electronic?) but how on Earth does it work on Win7? :slight_smile:

Can you change the disk to msdos partition table?

I guess so.
But my problem is that the disk’s capacity is recognized incorrectly (1.3TB), for some reason the partition table is read properly, it says that the main partition is 7.3TB.

If I would change the partition table from gpt to msdos (mbr?), the largest partition could be 2TB. But when the disk was completely empty, fdisk showed 1.3TB capacity.

osmc@osmc:~$ sudo mount /dev/sda2 /mnt/largedisk
mount: special device /dev/sda2 does not exist
osmc@osmc:~$

This is probably because the second partition’s end points beyond the capacity of the disk.

osmc@osmc:~$ ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 Aug  7 21:58 /dev/sda
brw-rw---- 1 root disk 8, 1 Aug  7 21:58 /dev/sda1
osmc@osmc:~$

But:

osmc@osmc:~$ sudo mount /dev/sda1 /mnt/largedisk
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
osmc@osmc:~$

And this is in dmesg:

[331207.506941] sda: sda1
[331307.584650] sda: sda1
[331816.383751] sda: sda1
[331816.434779] sda: sda1
[331845.819379] sda: sda1
[332357.032056] sda: sda1
[338526.810710] sda: sda1
[339569.980338] sda: sda1
[339659.646544] sda: sda1
[339971.083217] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[339971.083238] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 1th superblock
[339971.085040] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[339971.085057] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 2th superblock
[339971.085101] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[339971.085112] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 1th superblock
[339971.085122] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[339971.085131] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 2th superblock
[340004.602687] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[340004.602709] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 1th superblock
[340004.604457] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[340004.604471] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 2th superblock
[340004.604519] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[340004.604529] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 1th superblock
[340004.604541] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[340004.604549] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 2th superblock

I don’t think there’s a benefit of using F2FS on spinning rust

It should be some mistake. sda1 is the first partition that win7 created when I asked it to initialize the drive. On the other hand in fdisk’s output it is Microsoft reserved

osmc@osmc:~$ fdisk /dev/sda

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda: 1.3 TiB, 1404493455360 bytes, 2743151280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2D48D475-5139-44FD-9082-FEE7D44A1CF0

Device      Start         End     Sectors  Size Type
/dev/sda1      34      262177      262144  128M Microsoft reserved
/dev/sda2  264192 15628052479 15627788288  7.3T Microsoft basic data

Command (m for help): q

osmc@osmc:~$ parted
WARNING: You are not superuser.  Watch out for permissions.
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: Can't have a partition outside the disk!
Ignore/Cancel? i
Model: ST8000DM 004-2CX188 (scsi)
Disk /dev/sda: 1404GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name                          Flags
 1      17.4kB  134MB   134MB                Microsoft reserved partition  msftres
 2      135MB   8002GB  8001GB  ntfs         Basic data partition          msftdata

(parted)

Ok, sda1 should not be mountable…

That reserve partition is only created when you install Windows on a disk with no partitions. I am confused on how it would get there as well as why a 512b sector size is being used.

As a Windows user I would plug it back into Windows and run diskmgmt.msc, delete all partitions on that drive and then tell it to make a new one (I would use the default options).

Sure, as a Windows user I would have no problem with this setup anyway. ~100MB part of 8TB is lost. Not a big deal.
My problem is that Linux doesn’t see the disk as 8TB capacity (the partition table doesn’t play any role here I’m afraid), while Win7 does. Well, not for the first time, and this is again something that bothers me…

All right, I have a bad feeling.
So, the capacity of this disk by spec (from Seagate: https://www.seagate.com/files/www-content/product-content/barracuda-fam/barracuda-new/en-us/docs/100805918l.pdf) is 15,628,053,168 sectors (each having 512 bytes). This is a 34bit long number, and if I binary AND this with 0xFFFFFFFF (32bit - 2TB) I get 2743151280, the exact number that is printed by fdisk as the number of sectors. The external HDD is capable of handling only 32bit wide sector numbers.
Stupid windows simply believes what’s in the partition table (that was created using one of the SATA i/f of the MoBo). When there was no partition table, the USB interface used what I received from the device: 1.3TB capactity. Using the SATA interface the drive was recognized properly and the gpt partition table written properly. Next time booted up using the USB i/f win7 found a valid partition table and used what’s defined in it…
Probably it would fail when I’d go beyond 2TB using USB.

Well, how to test this marvelous theory? I try to fill up this drive somehow on windows… I will let you know the results.