3

I have a Kingston DataTraveler 2.0 16GB USB flash-drive:

The weird part with this USB flash-drive is that despite the fact that I have zero-filled the flash-drive:

# dd if=/dev/zero of=/dev/sdc bs=10M
dd: writing `/dev/sdc': No space left on device
1490+0 records in
1489+0 records out
15614803968 bytes (16 GB) copied, 3837.37 s, 4.1 MB/s
# 

..it still represents itself like it has a partition on:

# fdisk -l /dev/sdc*

Disk /dev/sdc: 15.6 GB, 15614803968 bytes
64 heads, 32 sectors/track, 14891 cylinders, total 30497664 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
Disk identifier: 0x00000000

Disk /dev/sdc doesn't contain a valid partition table

Disk /dev/sdc1: 241 MB, 241172480 bytes
64 heads, 32 sectors/track, 230 cylinders, total 471040 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
Disk identifier: 0x00000000

Disk /dev/sdc1 doesn't contain a valid partition table
# 

gdisk shows different GUID for both /dev/sdc and /dev/sdc1. If I grep the output of dmesg for sdc1, then only output is:

[21329562.191413]  sdc: sdc1

How to understand such flash-drives?

2

The kernel maintains a copy of the partition table in memory. It doesn't actually remember where the partition table is stored, so it doesn't detect that the partition table has changed on the disk. That's why you're still seeing the partition that was there before.

You need to tell the kernel to parse the disk again to update its in-memory partition table. Run partprobe /dev/sdc. Partitioning tools such as fdisk do that for you when they write a new partition table to the disk, but if you write to the disk directly, you need to inform the kernel manually.

|improve this answer|||||
  • 1
    @Martin: Exactly, just run partprobe /dev/sdc → that's all... – ncomputers Feb 7 '16 at 0:28
  • Thanks for this information! However, if I executed partprobe /dev/sdc, the /dev/sdc1 was still present. Only if I reinserted the USB flash-drive or executed the **w**(write table to disk and exit) command in fdisk, the /dev/sdc1 was removed. – Martin Mar 8 '16 at 22:55

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.