[sf-lug] Trying to determine the actual size of a USB drive

John Magolske b79net at gmail.com
Tue Aug 30 23:28:43 PDT 2011


Hi all, thanks for the helpful suggestions.

* Rick Moen <rick at linuxmafia.com> [110829 21:37]:
> [...] 'dmesg | less' should show you quite a bit of what the kernel
> is probing about that USB device after the USB layer notices its
> attachment. Like this:

Ok, here's what comes up...seems to think it's 16GB:

  [371726.796299] usb 1-1: new high speed USB device using ehci_hcd and address 3
  [371726.922376] usb 1-1: New USB device found, idVendor=13fe, idProduct=3100
  [371726.922384] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
  [371726.922391] usb 1-1: Product: Rally2
  [371726.922397] usb 1-1: Manufacturer: OCZ
  [371726.922402] usb 1-1: SerialNumber: 07980102B7EC11BB
  [371726.923318] scsi47 : usb-storage 1-1:1.0
  [371727.946587] scsi 47:0:0:0: Direct-Access  OCZ  Rally2  PMAP PQ: 0 ANSI: 0 CCS
  [371727.947066] sd 47:0:0:0: Attached scsi generic sg1 type 0
  [371728.344430] sd 47:0:0:0: [sdb] 31309824 512-byte logical blocks: (16.0 GB/14.9 GiB)

* Jeff Bragg <jackofnotrades at gmail.com> [110829 21:37]:
> [...] Rather than trying to fill up the drive, you could copy what's
> on it off into a directory on the same host, then find out how big
> the host believes that is.

Good idea, here's what I found:

  % df -h
  Filesystem            Size  Used Avail Use% Mounted on
  [...]
  /dev/sdb1              15G  7.3G  6.7G  53% /fd/e1
  
  % cp -a /media/* /tmp/rally2
  % du -sh /tmp/rally2
  7.2G    /tmp/rally2    (7484764242 bytes)

* Mike Higashi <mhigashi at gmail.com> [110830 21:02]:
> I'm wondering if you could use dd to copy the raw device to a image file
> on another disk, and see what the resulting file size is. This is a read
> operation for the flash chip, so you're not shortening the life cycle.

Tried this too:

  % dd if=/dev/sdb1 of=/tmp/rally2.img bs=4096
  3912720+0 records in
  3912720+0 records out
  16026501120 bytes (16 GB) copied, 515.143 s, 31.1 MB/s
  dd if=/dev/sdb1 of=/tmp/rally2.img bs=4096  2.78s user 64.72s system 13% cpu 8:35.24 total
  
  % ls -oh /tmp/rally2.img
  -rw-rw-r-- 1 jm 15G 2011-08-30 22:20 /tmp/rally2.img

At this point I'm inclined to believe this drive really is an actual
16GB device.

John

-- 
John Magolske
http://B79.net/contact




More information about the sf-lug mailing list