View Full Version : two simple USB questions
y_gross
2004-10-01, 07:49 AM CDT
1. How do I know which sda should I mount my USB to?
2. In /etc/fstab, what is the fstype? vfat?
Thanks, Oren
CrystalCowboy
2004-10-01, 08:29 AM CDT
I don't understand question 1. Various devices will be assigned sda, sdb, sdc... If you are unsure which is which, you can examine file /proc/scsi/scsi where they will be listed (because they are emulated as scsi). You can also examine the device by becoming root and running fdisk. This will gives you clues about which device is which and will also give you a list of partitions on the device and their file system type. Usually USB storage devices come pre-formatted with a vfat file system, which sucks for performance but is fairly universal.
Here's an example, I just hooked up my digital camera to my computer.
me@computer> cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: OLYMPUS Model: X200,D560Z,C350Z Rev: 1.00
Type: Direct-Access ANSI SCSI revision: 02
OK, the camera has been recognized. Since it's the only SCSI-emulated device, I know it's going to be sda, and from previous experience I know that I need to mount partition sda1.
Here's my entry in /etc/fstab:
/dev/sda1 /mnt/cam auto noauto,owner,user 0 0
Of course make sure the mount point directory exists. Note the automatic recognition of the file system type. You don't need to know whether it's vfat or not. Just in case I wasn't sure, I'll become root and check the partition table:
# fdisk /dev/sda
Command (m for help): p
Disk /dev/sda: 131 MB, 131072000 bytes
16 heads, 32 sectors/track, 500 cylinders
Units = cylinders of 512 * 512 = 262144 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 500 127976+ 6 FAT16
Command (m for help): q
#
I was right about it being device /dev/sda. There is one partition, sda1, and It turns out to be FAT16. I'm ready to do the mount. Since it is user-mountable, I can do that under my own account, not using root.
me@computer> mount /mnt/cam
Quella
2004-10-01, 08:30 AM CDT
If you do not have any other SCSI drives (sda,sdb, etc.) you would ude sda1 as your mount of the first USB device. If you took it to another linux box with a different list of drives, this would change for that machine. By default, most of the time you can try sda1 and it will work.
Th equestion on VFAT as the type is also very valid for most of the flash USB drives. It does not mean that others care not reformatted as some other filesystem type. The OS is good as guessing, but if I had to place this in the fstab, I woudl go with the most common being 'vfat'.
Hope it helps.
Quella
deuch
2004-10-01, 09:03 AM CDT
Simply things at he beginning ...
Type fdisk -l to have a list of drive mounted (generally /mnt/sda1)
Create a directory like "usbkey" in mnt : /mnt/usbkey
mount your usbkey like this :
mount -v vfat /dev/sda1 /mnt/usbkey (as root)
In your fstab you have to set the umas at 000 to allow other user (not root) to use the usb key.
hope it helps,
deuch
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.