I have a 500GB USB HD.

I have been messing around with the dd cmd - erasing MBR data, copying my windows internal HD, eleting partitions, etc.

fdisk -l returns

Disk /dev/sdc: 10MiB, 10485760 bytes, 20480 sectors
Units: sectors of 1 * 512 bytes = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk Identifier: 8xb77d52b7

Device    Boot  Start   End         Blocks      Id  System
/dev/sdc1 *     2048    718847      358400      7   HPFS/NTFS/exFAT
/dev/sdc2       718848  81922047    40601600    7   HPFS/NTFS/exFAT

lsblk returns

sda     0:0     0  465.9G  0  disk 
>^sda1  0:1     0  350M    0  part
>^sda2  0:2     0  38.7G   0  part
sdc     8:32    0  465.8G  0  disk
loop0   7:0     0  275.1M  0  loop /livemnt/squashfs

lsblk shows 465.8G whilst fdisk -l shows 10MiB

As the HD is, I can not do much with it... even cmds such as dd if=/dev/sda of=/dev/sdc bs=4096 will allow only up to 10MB of data from the if= source to the of= target...

cat /dev/sda > /dev/sdc returns

cat: write error: no space left on device

I have been going at this for 4 hours with tools like parted, fdisk /dev/sdc, gdisk, is this really that difficult?

There must be a way to just return the HD to its 500GB state...

To confirm that /dev/sdc is the external HD, I dissconnected/reconnected the USB HD and ran the following

dmesg | tail returns

[sdc] Attached SCSI disk
  • @Fox Yes occasionally I have been dissconnecting/reconnecting the USB. Windows currently doesn't see any HD when attaching it... I could probablly fix this situation using Windows DISKPART, however I am trying to move over and learn linux - something im beginning to think is pointless in all honesty. There seems to be alot of ambiguity from what Im seeing. I am still trying to find a way to fix this in linux. – Jimbo'sGun's Jul 15 '16 at 20:39
  • @Fox It is definitely /dev/sdc, your cmd results in [sdc] Attached SCSI disk – Jimbo'sGun's Jul 15 '16 at 20:40
  • @Fox I have done this already and it does effect the Disk, after the cmd successfully execs, running fdisk -l will return Disk /dev/sdc: 512B, 512 bytes, 1 sectors. This shows no partition tables such as /dev/sdc1, /dev/sdc2 etc Also if I then was to try dd if=/dev/sda of=/dev/sdc bs=512 the cmd will run upuntil it reaches 10MB of space, even though my internal /dev/sda drive is 500GB with around windows 8.1 OS taking up 30GB of that space... – Jimbo'sGun's Jul 15 '16 at 20:46
  • What is the brand and type (spinning disk, SSD, or hybrid) of this drive? – Timothy Martin Jul 15 '16 at 20:54
  • @TimothyMartin It is a samsung S2 500GB portable Hd, I think Spinning Disk - I have had it for 6 years, no bad sectors(can remember running a cmd succesfully on it yesterday when it was being recognised as its 400+GB capacity). – Jimbo'sGun's Jul 15 '16 at 20:59

MBR (aka "Disklabel type: dos") should not mention the disk size directly (nor the number of legacy cylinders/sectors/heads).


Nor should the kernel limit writes to the block device, based on a corrupt MBR on that device. So either the kernel or hardware was confused. Worryingly so :).

At a guess, no space left on device is generated directly by the kernel. If the device return an error to the kernel and complained about access beyond the end (happening because the kernel thought it wasn't beyond the end), I suspect the kernel would return a generic IO error instead. And I'd be surprised if this specific device error wasn't shown in the kernel log (dmesg).

The strange thing is that while lsblk and fdisk use slightly different approaches, AFAICT both are reading a value which is cached in the kernel. If they consistently get different values, this also sounds like it's the kernel acting buggy. It's possible fdisk -l requests a rescan before reading the value. However it sounds like you ran lsblk after fdisk -l, so that difference shouldn't matter.

I would retain a slight suspicion of this system. ("Am I maintaining independent backups of any valuable data, as would be good practice?" suspicious).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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