LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-11-2008, 10:03 AM   #1
tinker123
LQ Newbie
 
Registered: Oct 2008
Posts: 11

Rep: Reputation: 0
What is going on with my USB stick?


Hi;

I got a free 1 Gig USB stick as a promotional. I would like to install SystemRescueCD on it to make it into a "live usb stick". My computer is running Ubuntu 8.04.

I am having trouble detecting the device it is on and I think there may be partition or file system issues on the stick.

First issue: finding out what device the USB stick is:

running this command

Quote:
cat /proc/partitions
yields with the USB stick plugged in (& autodetected) and NOT plugged in to eliminate my computer's devices yields this:

Quote:
8 16 987135 sdb
8 17 979933 sdb1
I get 2 device names, but I only have one USB ( or any ) device plugged into my computer.

Why do I get two device names?

funning modprobe with the USB plugged in and automounted by Ubuntu yields nothing

Quote:
root@Wisdom:~# modprobe usb-storage
root@Wisdom:~#
runnng dmesg seems to indicate a problem, but I don't understand the output

Quote:
root@Wisdom:~# dmesg | tail -n 50
[ 8014.002943] sd 7:0:0:0: [sdb] Write Protect is off
[ 8014.002950] sd 7:0:0:0: [sdb] Mode Sense: 00 00 00 00
[ 8014.002953] sd 7:0:0:0: [sdb] Assuming drive cache: write through
[ 8014.006049] sd 7:0:0:0: [sdb] 1974271 512-byte hardware sectors (1011 MB)
[ 8014.006924] sd 7:0:0:0: [sdb] Write Protect is off
[ 8014.006929] sd 7:0:0:0: [sdb] Mode Sense: 00 00 00 00
[ 8014.006932] sd 7:0:0:0: [sdb] Assuming drive cache: write through
[ 8014.006939] sdb: sdb1
[ 8014.116805] sd 7:0:0:0: [sdb] Attached SCSI removable disk
[ 8014.116859] sd 7:0:0:0: Attached scsi generic sg3 type 0
[ 9316.958841] cdrom: This disc doesn't have any tracks I recognize!
[10381.662373] FAT: invalid media value (0xa5)
[10381.662381] VFS: Can't find a valid FAT filesystem on dev sdb.
[11014.741098] FAT: invalid media value (0xa5)
[11014.741106] VFS: Can't find a valid FAT filesystem on dev sdb.
[11288.298450] usb 4-2: USB disconnect, address 7
[11293.905004] usb 4-2: new high speed USB device using ehci_hcd and address 8
[11294.040007] usb 4-2: configuration #1 chosen from 1 choice
[11294.071004] scsi8 : SCSI emulation for USB Mass Storage devices
[11294.077307] usb-storage: device found at 8
[11294.077313] usb-storage: waiting for device to settle before scanning
[11299.074071] usb-storage: device scan complete
[11299.075331] scsi 8:0:0:0: Direct-Access USB 2.0 Flash Disk 0.00 PQ: 0 ANSI: 2
[11299.082540] sd 8:0:0:0: [sdc] 1974271 512-byte hardware sectors (1011 MB)
[11299.083541] sd 8:0:0:0: [sdc] Write Protect is off
[11299.083548] sd 8:0:0:0: [sdc] Mode Sense: 00 00 00 00
[11299.083551] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[11299.086894] sd 8:0:0:0: [sdc] 1974271 512-byte hardware sectors (1011 MB)
[11299.087889] sd 8:0:0:0: [sdc] Write Protect is off
[11299.087894] sd 8:0:0:0: [sdc] Mode Sense: 00 00 00 00
[11299.087897] sd 8:0:0:0: [sdc] Assuming drive cache: write through
[11299.087904] sdc: sdc1
[11299.197969] sd 8:0:0:0: [sdc] Attached SCSI removable disk
[11299.198024] sd 8:0:0:0: Attached scsi generic sg3 type 0
[11300.740252] FAT: Directory bread(block 3858) failed
[11300.740267] FAT: Directory bread(block 3859) failed
[11300.740275] FAT: Directory bread(block 3860) failed
[11300.740282] FAT: Directory bread(block 3861) failed
[11300.740289] FAT: Directory bread(block 3862) failed
[11300.740296] FAT: Directory bread(block 3863) failed
[11300.740303] FAT: Directory bread(block 3864) failed
[11300.740310] FAT: Directory bread(block 3865) failed
[11300.740361] FAT: Directory bread(block 3858) failed
[11300.740368] FAT: Directory bread(block 3859) failed
[11300.740375] FAT: Directory bread(block 3860) failed
[11300.740382] FAT: Directory bread(block 3861) failed
[11300.740388] FAT: Directory bread(block 3862) failed
[11300.740395] FAT: Directory bread(block 3863) failed
[11300.740401] FAT: Directory bread(block 3864) failed
[11300.740408] FAT: Directory bread(block 3865) failed
root@Wisdom:~#


running fdisk -l on the first device sdb yields

Quote:
Disk /dev/sdb: 1010 MB, 1010826752 bytes
255 heads, 63 sectors/track, 122 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0007627f

Device Boot Start End Blocks Id System
/dev/sdb1 1 122 979933+ c W95 FAT32 (LBA)
root@Wisdom:~#
running fdisk -l on the second device yields listings that are almost identical ( the same device, two partitions? ) except no file system

Quote:
Disk /dev/sdb1: 1003 MB, 1003451904 bytes
255 heads, 63 sectors/track, 121 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
root@Wisdom:~#
To figure out which is my USB I replugged the stick in and let Ubuntu auto detect and mount it. I then put a file called Hello.txt on it and then I unmounted the USB stick.

Attempting to mount the first device, sdb yields an error message

Quote:
root@Wisdom:~# mount -t vfat /dev/sdb /mnt/usb
mount: wrong fs type, bad option, bad superblock on /dev/sdb,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

root@Wisdom:~#
Attempting to mount the second device, sdb1 is successful and it has my text file

Quote:
root@Wisdom:~# mount -t vfat /dev/sdb1 /mnt/usb
root@Wisdom:~# ls /mnt/usb
Hello.txt
root@Wisdom:~#
So, I come back to the question, why 2 device names when there is only one USB device plugged in?

Thanks much in advance for any info
 
Old 10-11-2008, 05:08 PM   #2
Nightfish
Member
 
Registered: Sep 2008
Posts: 36

Rep: Reputation: 15
kind of a long description of a problem for such a short answer.
Some usb sticks have a virtual partition where they try to emulate a floppy drive(a: or b where the security lock for the main partition is located and other things.
Try plugging it in to a windows computer (yea I know how that sounds) and see what happenes. If you get 2 drives, one beeing a floppy, you get your answer, if not... just format the whole thing.

Fedora Development

Last edited by Nightfish; 10-22-2008 at 12:47 PM.
 
Old 10-11-2008, 05:50 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,862

Rep: Reputation: 739Reputation: 739Reputation: 739Reputation: 739Reputation: 739Reputation: 739Reputation: 739
There is nothing wrong.
sdb is your entire drive
sdb1 is the 1st partition. This contains the filesystem i.e data which is typically FAT32.

In a nutshell partitions divide a drive into pieces. Lots of information on partitions can be found by googling. A flash drive can be divided into 15 partitions (since it is uses the SCSI subsystem) with 4 being called primary. A primary partition can be designated as an extended partition which can be subdivided into 11 logical partitions. A data (primary,logical) partition can not be subdivided which is why nothing is displayed on the output of fdisk for /dev/sdb1. You can only mount a data filesystem which in your case is just sdb1.

If you look at the entire output of cat /proc/partitions you should see multiple partitions for the internal drive.
 
Old 10-12-2008, 09:34 AM   #4
tinker123
LQ Newbie
 
Registered: Oct 2008
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for the answers guys.

Is there any way ( and do I want to ) to blow away the sdb1 partition?
I would like to use the whole USB stick for a liveUSB stick
 
Old 10-12-2008, 01:25 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,008

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
Quote:
Is there any way ( and do I want to ) to blow away the sdb1 partition?
As michaelk says, you have only the one partition /dev/sdb1
Use it as you wish.
If you "blow it away", you'll only have to re-create it again, one way or another.
 
Old 10-13-2008, 10:01 AM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
You can use dd to completely wipe the usb stick.

dd if=/dev/random of=/dev/sdb

Then use fdisk to re-create a primary partition on it.

Then you can use mkfs or the like to create the type of filesystem you want on it.
 
Old 10-13-2008, 10:16 AM   #7
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
/dev/sdc is the device for the drive. /dev/sdc1 is the device for the partition on the device. Before the partition is the MBR. The partition probably starts at block 63. You can check this with "sudo /sbin/fdisk -lu /dev/sdc".

You can also get information on your pendrive with "udevinfo -q info -n /dev/sdc1". It will show what filesystem is on it, the label and UUID of the filesystem.

Last edited by jschiwal; 10-13-2008 at 10:19 AM.
 
Old 10-13-2008, 02:08 PM   #8
oskar
Senior Member
 
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,138

Rep: Reputation: 49
Quote:
Originally Posted by trickykid View Post
You can use dd to completely wipe the usb stick.

dd if=/dev/random of=/dev/sdb

Then use fdisk to re-create a primary partition on it.

Then you can use mkfs or the like to create the type of filesystem you want on it.
Just want to caution anyone to double check if that is really the drive they want to wipe clean. Your usb drive will not always get mounted at /dev/sdb. If you, like me, sometimes have a problem with hal or your usb card where it disconnects and reconnects drives for no apparent reason, the device name might change without you doing anything.

I guess the most secure way would be to do this by UUID (potentially more confusing) or if possible by the devices individual name, if set. I did a quick search to see if I can find anything on this, but I can't. I'm kind of curious myself if and how that might be possible.
 
Old 10-13-2008, 06:46 PM   #9
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
If there is a problem with the filesystem on the drive, you could simply format the filesystem on /dev/sdb1 (assuming that is what is used).
But having /dev/sdb and /dev/sdb1 for example is normal. There is nothing wrong with that.

I tried to use a promotional usb drive at work and windows didn't even recognize it. The same thing happened when a Windows server was being installed. One of the installers had files he needed to install copied to a pen drive he got from Disney at NAB. Windows didn't see it. I had a laptop that I had dual booting with Mandrake Linux. I rebooted into Mandrake, inserted the pendrive and sent the files over the network.

If this is a pendrive that has some promotional material on it, it may have some defects intentionally in the filesystem to make it harder to delete the promotional material. Some pendrives will simulate a hard disk for part of it. (U3 and others).

You can use "udevinfo -q env -n /dev/sdb1" to determine the filesystem, label and UUID. If you wanted to add an entry in /etc/fstab for the pendrive, you would want to use "LABEL=" or "UUID=" instead of the device name in the first field of the /etc/fstab entry. Also use the "noauto" option. This will enable you to mount it (manually) even if it gets a different device assigned to it the next time you plug it in.

Trickykid: You don't want to wipe a hard drive using /dev/random. You will run out of entropy very quickly. You can use /dev/urandom oro /dev/zero instead. A pen drive is flash based so you don't need to worry about previous material being extracted as can happen to one or two layers of magnetic material.

Last edited by jschiwal; 10-13-2008 at 06:49 PM.
 
  


Reply

Tags
drive, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How Do mount USB stick connected to pcmcia-usb-adapter Raamisaha Linux - Newbie 3 02-11-2008 10:46 AM
*** USB external hard drive and USB memory stick linux_2007_ Linux - General 1 07-17-2007 04:20 PM
Boot from USB stick if no booting USB in Bios 1kyle Suse/Novell 1 03-26-2007 12:24 AM
mount/umount usb stick - PQI Intelligent Stick 2.0 sandbag Linux - Software 5 05-06-2005 11:12 AM
USB problems: Memorex USB stick 256MB and PSX to USB adapter by Radio Shack Knuckles T15 Linux - Hardware 1 05-19-2004 06:58 PM


All times are GMT -5. The time now is 06:53 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration