Copying USB stick fails with device errors

Alex mysqlstudent at gmail.com
Thu Jun 7 00:41:18 UTC 2012


Hi,

I'm trying to copy a USB stick that I purchased that's supposed to
contain a bootable desktop with a bunch of applications like firefox,
openoffice, etc. The USB stick somehow actually contains two devices.
One has a vfat filesystem and the other appears to be NTFS. When
mounted, it has some sort of fedora variant in a tarball on it that's
actually the bootable desktop.

When I try to use dd to copy it, it eventually times out, produces an
error like "sdb: unable to read partition table" and makes the device
entirely inaccessible. I'm also unable to mount the resulting dd image
as a loopback vfat filesystem once my copy has completed.

There seems to be a disparity between what fdisk shows is the length
of the filesystem and how much space is actually allocated? How did
they create two devices within the one device?

dmesg contains this info when I insert the USB stick:

[1857968.944942] sd 75:0:0:0: [sdb] 7559249 512-byte logical blocks:
(3.87 GB/3.60 GiB)
[1857968.945310] sd 75:0:0:1: [sdc] 25307055 512-byte logical blocks:
(12.9 GB/12.0 GiB)

Here's the output from fdisk:

# fdisk -l /dev/sdb /dev/sdc

Disk /dev/sdb: 3870 MB, 3870335488 bytes
45 heads, 4 sectors/track, 41995 cylinders, total 7559249 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: 0x261e6d11

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           4     5242859     2621428    b  W95 FAT32

Disk /dev/sdc: 13.0 GB, 12957212160 bytes
229 heads, 55 sectors/track, 2009 cylinders, total 25307055 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: 0x7d2c8154

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            9048    24272568    12131760+   7  HPFS/NTFS/exFAT

# file usbstick.dd
usbstick.dd: x86 boot sector; partition 1: ID=0xb, active, starthead
1, startsector 4, 5242856 sectors, code offset 0x31

What's the proper way to copy the entire USB stick as an image?

I suspect the issue is that the bootsector is within the first four
blocks, and the filesystem begins after that. How can I tell "mount"
to look for the filesystem after the first four blocks?

Somehow when I insert the USB stick on my fedora16 desktop, it's
already mounted (by udev?) and I can see the contents, so there is a
valid filesystem on the original USB stick.

Thanks,
Alex


More information about the users mailing list