Gordon Dexter on 15 Aug 2009 08:26:17 -0700 |
Edmond Rodriguez wrote: > Is there a reason why mounting a formatted usb stick drive with no partition table would be a bad practice? > > > 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..) > > The drive mounts fine and I tried putting some large files in it, which also worked fine. > > A comment was made at the meeting that the stick drive had no partition table, which was true. Though fdisk shows me a partition table, the data looks random, and a warning is printed that the device probably has no partition table. > > Someone was also surprised I could successfully mount this drive to /dev/sda. I have googled and seen a few sites discussing doing the same thing. > > All seems well. but is there a reason this is NOT a good practice (using the drive with no partition table)? I think the only thing is that other operating systems might not like it. I have no idea how Windows would handle it in particular. Honestly it sounds as if the you think you have a hardware issue, but I don't think so. If the disk is missing a partition table it's trivial to give it one using fdisk. If the partition nodes don't appear upon insertion then you might have a UDEV issue, but since you can use the stick formatted directly I'm sure it works just fine. Assuming that you don't care about any of the data on the disk, you should just zero the beginning of the disk where the partition table goes (dd if=/dev/zero of=/dev/sda bs=512 count=1) use fdisk to create a normal partition table (fdisk will realize that the partition table is zeroed out and fix that, just add a single partition and write), then format that single partition. You may have to unplug and reinsert the drive, or even reboot, but after you do you'll find that Linux reads the partition table, and unless you're using something archaic like static nodes in /dev, you'll see /dev/sda1 appear, ready to format. The formatting the raw disk works because to Linux they're both block devices, and it doesn't care if the disk has a part table or not. You can format sda and it doesn't care, although some of the fancier HAL-based auto-mounting stuff probably won't work. Incidentally, you can run fdisk on a device like /dev/sda1, and write a partition table to it as well, subdividing a partition into more partitions, but this isn't useful because Linux only checks the raw disk for a partition table when it creates dev nodes--it won't create dev nodes like /dev/sda1-3 Hope that answers your question. --Gordon ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|