Hi All,

I have a 4TB drive that was originally in a PC connected via SATA. I now wish to put it in an external enclosure and connect it via USB, however this is proving more difficult than I expected, and from what I understand it’s Windows XP’s fault.

On attempting to mount the drive with sudo mount /dev/sdc /mnt, I receive the following error:

mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdc, missing codepage or helper program, or other error.

The output of fdisk -l is as follows:

Disk /dev/sdc: 3.64 TiB, 4000787025920 bytes, 976754645 sectors
Disk model: Expansion Desk
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdc1           1 4294967295 4294967295  16T ee GPT

As can be seen, the disk is detected correctly as a 3.64TiB drive, but there is a partition that’s read as 16TB. This, AFAIK, is because the sectors are incorrectly read as 4096 bytes long when they should be 512 bytes, and this is a thing that external enclosures do to ensure MBR compatibility with Windows XP.

I tried overcoming this by mounting as follows:

$ sudo mount -o ro,offset=$((1*512)) /dev/sdc1 /mnt

however now I have a new error:

mount: /mnt/tmp: failed to setup loop device for /dev/sdc1.

Trying to mount with sudo mount /dev/sdc1 /mnt only yields

mount: /mnt/tmp: special device /dev/sdc1 does not exist.

I’m at a loss as to how to mount this drive - at least, without reformatting it. Is it at all possible? Once I’ve cracked the code, can I configure /etc/fstab to do it automatically for me, or am I stuck in this limbo-land where I have data on my disk that’s only readable with a hacky workaround? As a last resort, I think I can plug it back in via SATA, copy all 4TB off, plug it in via USB, reformat it and copy everything back on, but I want to avoid that hassle.

    • I'm Hiding 🇦🇺@aussie.zoneOP
      link
      fedilink
      arrow-up
      0
      ·
      8 months ago

      I’m not using Windows. I run Debian on this server.

      The bulk of external enclosures that money can buy tell the computer they’re plugged into that the disks have logical sector sizes of 4096 bytes, apparently for compatibility with >2TB drives on Windows XP.

      I do not need compatibility with Windows XP as the current year is 2024. My disk has logical sectors 512 bytes in size, but the external enclosures don’t report that. I want to know how I can mount the disk anyway, despite the enclosure’s attempts to thwart me. I know the disk is fine, as it is detected with 512 byte sectors and mounts happily via SATA.

      • z00s@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        8 months ago

        Do you really need 512 byte sectors for any specific reason? If not, just drop it back into the PC, backup contents, reformat, copy data back then put it back in the enclosure. Job done.

    • I'm Hiding 🇦🇺@aussie.zoneOP
      link
      fedilink
      arrow-up
      0
      ·
      8 months ago

      No - I’ve been working on a headless server, and ideally I need this thing to be written into /etc/fstab and work reliably from the command line. I could plug the drive into my laptop to have a look in some GUI tools if you think there’s one around that can circumvent the sector size mismatch, but in the end I’ll need a CLI method.

      • yo_scottie_oh@lemmy.ml
        link
        fedilink
        English
        arrow-up
        0
        ·
        8 months ago

        Gotcha. Worst case, if you can mount it using any tool (GUI or CLI), then maybe you can copy its contents to another drive, reformat it, and copy the contents back.

  • ares35@kbin.social
    link
    fedilink
    arrow-up
    0
    ·
    8 months ago

    i have a some sata->usb adapters/enclosures/docks that can’t be used with > 2tb drives or with 4Kn (native 4k sectors, no 512 emulation) drives. i also have a 2-bay cheap nas that can only do 2x1tb or smaller and there’s no new firmware or hacks to ‘fix’ it even though it’s linux under-the-hood.

    start with hooking it back up to sata to copy anything on it you want elsewhere, check the filesystem, and run the extended diagnostics.

    • onTerryO@lemmy.ca
      link
      fedilink
      English
      arrow-up
      0
      ·
      8 months ago

      This is the most likely problem. There is no way the output from fdisk should be different between the two connections if they are both working correctly.

      • ReversalHatchery@beehaw.org
        link
        fedilink
        arrow-up
        0
        ·
        8 months ago

        Probably I’m wrong, but it feels like nobody has read the post. As I understand it’s not a problem between 2 computers, but 1 computer and the drive being connected over USB with an enclosure or normally through SATA.

  • Bonehead@kbin.social
    link
    fedilink
    arrow-up
    0
    ·
    8 months ago

    I noticed in all of this that you haven’t done a fsck on the partition yet. This will tell you more than fdisk and likely fix the problem for you.

  • FigMcLargeHuge@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    8 months ago

    I think the first time you are trying to mount the drive and not the partition “sudo mount /dev/sdc /mnt” and on the second and third attempt have the sdc1 right, but need to make a folder under mnt to mount the drive onto. Make a folder like ‘tempdrive’ under /mnt and then try it with this since you said it was an ext4 filesystem. Note, you can name it whatever you want I just picked that as an example:

    cd /mnt

    sudo mkdir tempdrive

    sudo mount /dev/sdc1 /mnt/tempdrive

    If it doesn’t recognize the filesystem then use -t

    sudo mount -t ext4 /dev/sdc1 /mnt/tempdrive

    And yes, once you get it down, an fstab entry will make this mount every time, but I would use the uuid in the fstab. I have two mounted on a machine like this in my /etc/fstab:

    UUID=“6a95603a-2112-4c4d-ad4d-e146e646a74a” /media/largedrive ext4 auto,nofail,noatime,rw,user 0 0

    UUID=“3E31-540B” /media/new4tbdrive exfat auto,nofail,noatime,rw,user 0 0

  • kool_newt@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    8 months ago

    Just throwing some thoughts out there

    • fdisk shows /dev/sdc1 and mount doesn’t see it – did you perhaps unplug it and replug it causing potential renumeration?

    • Use the dmesg command to watch Linux detect the device

    • Use cat /proc/partitions to see the kernels view of storage devices

    • Check out the /dev/disk/by-label, /dev/disk/by-uuid, /dev/disk/by-partlabel etc and see how the point to each other

    e.g.

    $ ls -l /dev/disk/by-partlabel/arch-root lrwxrwxrwx 1 root root 10 Jan 25 19:46 /dev/disk/by-partlabel/arch-root -> ../../sda2

  • BCsven@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    8 months ago

    Looks like ee is legacy mbr type with an EFI entry right after it, it could be that somebody has solved mounting this if you deep dive. And maybe an additional package is needed. Buy are you able to remount to sata and just transfer data? becuase you would want to reformat this to a modern GPT and filesystem at some point. Or see if you can pass it through to an XP VM for data transfer.

  • KrapKake@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    8 months ago

    Did you try simply mounting /dev/sdc1 without the extra arguments? You also need to make a mount folder in /mnt, so

    sudo mkdir /mnt/mydrive

    Then

    sudo mount /dev/sdc1 /mnt/mydrive