JP Vossen on 13 Aug 2009 14:16:08 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] stick drive that mounts as /dev/sda (or sdb....)

 > Date: Thu, 13 Aug 2009 09:40:27 -0700 (PDT)
 > From: Edmond Rodriguez <>
 > Is there a reason why mounting a formatted usb stick drive with no
 > partition table would be a bad practice?

I started to say, 'yes, you are writing to the "raw" disk' but then 
looked into it a bit more and that seems to be valid sometimes.

 > During a meeting about two months ago, I mentioned I had a 4GB usb
 > stick drive that I could only mount to /dev/sda (or b or c etc..).  I
 > eventually learned I could mount it to /dev/sda (instead of sda1, or
 > sda2 etc..)

I'm surprised no one else has mentioned this.  /dev/sda refers to the 
entire disk.  /dev/sda1 refers to the first partition on that disk, sda2 
to the second, and so on.  I thought "entire" was also "raw" (i.e., 
without partition info), but I see in my /etc/fstab that:
	/dev/hdc   /media/cdrom0   udf,iso9660 user,noauto  0  0
	/dev/fd0   /media/floppy0  auto    rw,user,noauto   0  0
so it is valid at least sometimes.  Maybe Linux treats /dev/sda and 
/dev/sda1 as "the same" if there is only one partition?

The only other time I ever use /dev/sda is when I'm trying to nuke the 
disk, like:
	time shred -n3 -v -z /dev/sda

Wild-assed guess: maybe your USB drive isn't partitioned at all and you 
are just writing to it raw?  I would have guessed that that wouldn't 
work at all, but maybe...  Your "garbage" fdisk -l results might lend 
some support for my theory.  What do 'parted' or one of the other GUI 
partition manglers make of it?  If I were you I'd try to copy all the 
data off the key and re-partition and re-format it from orbit--just to 
be sure.

Here's what one of my keys looks like, stuck in my Mini9 running Jaunty:
$ sudo fdisk -l
Disk /dev/sdb: 1999 MB, 1999568384 bytes
255 heads, 63 sectors/track, 243 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000eef8c

    Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         243     1951866    b  W95 FAT32

Can anyone else correct me or add more details?

JP Vossen, CISSP            |:::======|
My Account, My Opinions     |=========|
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --