LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Difference between USB flash drive located at /dev/sda or /dev/sda1 (https://www.linuxquestions.org/questions/linux-hardware-18/difference-between-usb-flash-drive-located-at-dev-sda-or-dev-sda1-4175467686/)

hcourtice 06-28-2013 02:49 AM

Difference between USB flash drive located at /dev/sda or /dev/sda1
 
Hi,

This problem is similar to another (unresolved) question:
http://www.linuxquestions.org/questi...s-vfat-413719/


I have two USB Flash drives. One is recognised by U-Boot, and the other is not. I'm trying to determine what is different between them so that I can sort out why U-Boot is not reading the "Bad" one. Both have been formatted FAT32 in windows.

For the "Good" one, I can read the usb device from U-Boot.
> fatls usb 0
4165864 jffs2.wrap
1726520 kernel.wrap
3285730 romfs_1beta.tar.gz

3 file(s), 0 dir(s)


For the "Bad" one, I get an error message from U-Boot.
> fatls usb 0
No Fat FS detected




Both are recognised in linux, but they appear differently in /dev.

I am running Linux Kernel 3.5.3 using Snapgear distribution on Atemel ARM SAM9260 processor.

The "Good" one gets:
/dev/sda
/dev/sda1
/dev/sg0

The "Bad" one gets
/dev/sda
/dev/sg0


I can mount them both. For the "Good" one, I issue " mount /dev/sda1 /mnt/usb", and it mounts OK. For the "Bad" one I issue "mount /dev/sda /mnt/usb" , and it mounts OK.

< Plug in "Good" USB drive" >
scsi 3:0:0:0: Direct-Access Verbatim STORE N GO 5.00 PQ: 0 ANSI: 0 CCS
sd 3:0:0:0: Attached scsi generic sg0 type 0
sd 3:0:0:0: [sda] 3913728 512-byte logical blocks: (2.00 GB/1.86 GiB)
sd 3:0:0:0: [sda] Write Protect is off
sd 3:0:0:0: [sda] No Caching mode page present
sd 3:0:0:0: [sda] Assuming drive cache: write through
sd 3:0:0:0: [sda] No Caching mode page present
sd 3:0:0:0: [sda] Assuming drive cache: write through
sd 3:0:0:0: [sda] No Caching mode page present
sd 3:0:0:0: [sda] Assuming drive cache: write through
sd 3:0:0:0: [sda] Attached SCSI removable disk
# mount /dev/sda /mnt/usb
mount: mounting /dev/sda on /mnt/usb failed: Invalid argument
# mount /dev/sda1 /mnt/usb
# mount
....
/dev/sda1 on /mnt/usb type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)


< Plug in "Bad" USB drive" >
scsi 5:0:0:0: Direct-Access Verbatim STORE N GO 1.00 PQ: 0 ANSI: 2
sd 5:0:0:0: [sda] 3913728 512-byte logical blocks: (2.00 GB/1.86 GiB)
sd 5:0:0:0: Attached scsi generic sg0 type 0
sd 5:0:0:0: [sda] Write Protect is off
sd 5:0:0:0: [sda] No Caching mode page present
sd 5:0:0:0: [sda] Assuming drive cache: write through
sd 5:0:0:0: [sda] No Caching mode page present
sd 5:0:0:0: [sda] Assuming drive cache: write through
sd 5:0:0:0: [sda] No Caching mode page present
sd 5:0:0:0: [sda] Assuming drive cache: write through
sd 5:0:0:0: [sda] Attached SCSI removable disk

# mount /dev/sda1 /mnt/usb
mount: mounting /dev/sda1 on /mnt/usb failed: No such file or directory
# mount /dev/sda /mnt/usb
# mount
....
/dev/sda on /mnt/usb type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)



When I look at dmesg output, I get the following output ("Good" drive first).

usb 1-1: new full-speed USB device number 9 using at91_ohci
usb 1-1: New USB device found, idVendor=13fe, idProduct=3623
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: STORE N GO
usb 1-1: Manufacturer: Verbatim
usb 1-1: SerialNumber: 07A90908151B36A7
scsi7 : usb-storage 1-1:1.0
scsi 7:0:0:0: Direct-Access Verbatim STORE N GO 5.00 PQ: 0 ANSI: 0 CCS
sd 7:0:0:0: Attached scsi generic sg0 type 0
sd 7:0:0:0: [sda] 3913728 512-byte logical blocks: (2.00 GB/1.86 GiB)
sd 7:0:0:0: [sda] Write Protect is off
sd 7:0:0:0: [sda] Mode Sense: 03 41 00 00
sd 7:0:0:0: [sda] No Caching mode page present
sd 7:0:0:0: [sda] Assuming drive cache: write through
sd 7:0:0:0: [sda] No Caching mode page present
sd 7:0:0:0: [sda] Assuming drive cache: write through
sda: sda1
sd 7:0:0:0: [sda] No Caching mode page present
sd 7:0:0:0: [sda] Assuming drive cache: write through
sd 7:0:0:0: [sda] Attached SCSI removable disk
usb 1-1: USB disconnect, device number 9
usb 1-1: new full-speed USB device number 10 using at91_ohci
usb 1-1: New USB device found, idVendor=18a5, idProduct=0302
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: STORE N GO
usb 1-1: Manufacturer: Verbatim
usb 1-1: SerialNumber: 10V13000000034F0
scsi8 : usb-storage 1-1:1.0
scsi 8:0:0:0: Direct-Access Verbatim STORE N GO 1.00 PQ: 0 ANSI: 2
sd 8:0:0:0: [sda] 3913728 512-byte logical blocks: (2.00 GB/1.86 GiB)
sd 8:0:0:0: Attached scsi generic sg0 type 0
sd 8:0:0:0: [sda] Write Protect is off
sd 8:0:0:0: [ense: 03 00 00 00
sd 8:0:0:0: [sda] No Caching mode page present
sd 8:0:0:0: [sda] Assuming drive cache: write through
sd 8:0:0:0: [sda] No Caching mode page present
sd 8:0:0:0: [sda] Assuming drive cache: write through
sda:
sd 8:0:0:0: [sda] No Caching mode page present
sd 8:0:0:0: [sda] Assuming drive cache: write through
sd 8:0:0:0: [sda] Attached SCSI removable disk



Any explanation of the difference between these two drives much appreciated. Hopefully It will get me closer to working out why U-Boot only recognises one of them.

Thanks,

acid_kewpie 06-28-2013 03:21 AM

well "good" has a partition table on it, and (at least) 1 partition. "bad" has no partitions and the entire device is a single file system.

compare and contrast "fdisk -l /dev/sda" for each drive.

I would create a proper partition table on "bad" with fdisk or under windows. OR, if these sticks are just about the same, you could just maybe clone one to the other?

for clarity that you're doign the right devices, i'd suggest:

from "good":
dd if=/dev/sda of=/tmp/usb.img

to "bad":
dd if=/tmp/usb.img of=/dev/sda

hcourtice 06-28-2013 04:22 AM

Thanks for the quick solution.
 
Ok. Thanks for quick reply.I guess my version of u-boot expects partition table, I want to allow Usb firmware upgrade, so will need to sort a way for customers to partition from win.

hcourtice 06-28-2013 04:46 AM

Thanks for the quick solution.
 
Ok. Thanks for quick reply.I guess my version of u-boot expects partition table, I want to allow Usb firmware upgrade, so will need to sort a way for customers to partition from win.

jefro 06-28-2013 03:16 PM

Just like windows, unix and linux os's usually need a partition. Actually all could use an unpartitioned disk but it is not normal. As acid_kewpie suggested, you are missing a partition and that would suggest also formatted drive.

As for the command dd, I want to warn you, it is very dangerous. You have to be sure that your disk sequence would be sda or sdb or such. Also dd tends to work best on exact disk to disk copies. A 16g to 8g would fail usually. Even disk structure or CHS may be an issue.


Other ways that might work may be to use Clonezilla.

For a Windows user they do have dd for windows and rawritewin. There are some other "image" programs too.

hcourtice 07-04-2013 03:26 AM

Thanks for the info. This pointed me in the right direction. Some USB drives are partitioned as a "Super Floppy", with no Partition table. U-Boot can't read these disks. I used Windows diskpart to install a new partition table and all is good.


All times are GMT -5. The time now is 01:50 PM.