LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mounting a usb device (https://www.linuxquestions.org/questions/linux-newbie-8/mounting-a-usb-device-927984/)

tomg120 02-06-2012 08:14 PM

mounting a usb device
 
Hi All,
How does one mount a usb device when you have sata/scsi drives in use. Thanks.
tomg120

frankbell 02-06-2012 08:41 PM

At the risk of sounding cute, exactly as you would if you had IDE drives in use. The only difference is likely to be the third letter, the one after the sd.

If the USB device does not show up in your file manager automatically, which most of them do in contemporary Linux distros, you can run dmesg (likely you will have to run it as root) to find out how the computer is seeing the particular device.

For a better answer, please provide information about what type of device you are trying to mount, and how dmesg sees that device (please post only the relevant portion of the output from dmesg and surround it in "code" tags which become available when you click the "Go Advanced" button at the bottom of the quick reply window).

Ion Silverbolt 02-06-2012 08:48 PM

Most distros will automount it when you plug it in. Usually to a mount point in the /media folder.

If you need it to mount at boot to somewhere, you can put an entry for it in your fstab. If your devices have a bad habit of being assigned to other device locations, you can use the drives UUID and mount it that way.

Code:

blkid
/dev/sda1: UUID="920f7032-d17a-4f52-8b9b-32b3ccd21fd8" TYPE="ext2"
/dev/sda3: LABEL="System Reserved" UUID="28509A2C509A012C" TYPE="ntfs"
/dev/sda4: UUID="AC8CB78C8CB75016" TYPE="ntfs"
/dev/sda5: UUID="8689ac05-beeb-4442-bc01-bd3d4092c993" TYPE="swap"
/dev/sda6: UUID="ee0e0695-5cd2-4a46-a494-3fbccba718d7" TYPE="ext4"
/dev/sda7: UUID="76444e6c-9b3e-4144-8219-31c804814da0" TYPE="ext4"
/dev/sdb1: UUID="bfe42e9f-e4fe-4e23-ad5e-3c8a3b105188" SEC_TYPE="ext2" TYPE="ext3"
/dev/sr0: LABEL="BRIDGE" TYPE="iso9660"

In this example, my usb drive is /dev/sdb1. I have my fstab mount it to /mnt/usb at boot. The entry looks like this:
Code:

UUID=bfe42e9f-e4fe-4e23-ad5e-3c8a3b105188      /mnt/usb        ext3    noatime        0 1
You can also just manually mount it.
Code:

mount -U bfe42e9f-e4fe-4e23-ad5e-3c8a3b105188 /mnt/usb or
mount /dev/sdb1 /mnt/usb

Sometimes the device may be different. Especially if you have been plugging flash drives in. The UUID method is surefire.

jefro 02-06-2012 09:05 PM

Almost all modern distro's access drives as scsi no matter the type. As Frank says it would be normally how the bios sees them.

SDA1 would tend to be the first bootable drive and then the mounted order follows so that a usb might be mounted as sdd or such.

Simple mount command with no options may show it is mounted. Distro's tend to put usb mounts under /media but I don't know about slackware.

chrism01 02-06-2012 11:17 PM

Try
Code:

cat /etc/mtab
before and after attaching usb; you should see an extra entry if it automounts, as most modern distros/HW will.

frankbell 02-07-2012 08:04 PM

Oddly enough, I had to add a USB device to /etc/fstab today because it wasn't mounting with Slackware 13.37 on an older computer. The system say it, but, when I tried to open it, Konqueror threw a "Unable to mount [device]" message.

I did exactly as chrism_01 suggested. I looked at the /etc/mtab (Mount TABle file), then entered it in /etc/fstab (File System Table) file. I made two changes from the mtab entry: I set the mount to "auto" and the owner to "users."

Here is one of the clearest explanations of fstab that I've found on the net:

clocker 02-08-2012 07:23 AM

Is the usb device a modem or storage device? Classically all devices must be mounted on the /mnt directory, although these days they are mounted in the /media directory.

To view mounted devices
Quote:

#fdisk -l
To specify the ntfs file system
Quote:

#fdisk -l |grep NTFS
So you will be able to see the drive and its partitions as sda, sdb or hda what ever so write this. Don't forget to mkdir where you will mount the partitions.
Quote:

mount /dev/sdb1/ /mnt/dir_name

theNbomr 02-08-2012 11:56 AM

Quote:

Originally Posted by clocker (Post 4596998)
Is the usb device a modem or storage device? Classically all devices must be mounted on the /mnt directory, although these days they are mounted in the /media directory.

There have been various conventions used for mountpoints, but the choice has always been arbitrary. You are free to choose whatever mountpoints you find appropriate.

I tend to have all sorts of drives and devices that I mount and unmount as needs and wants dictate. The system I like is to create a list of directories under /mnt that contains names like 'sda1, sda2, sda3 ... sdg1, sdg2, sdg3, etc. Then, I just mount devices on mountpoint directories that reflect their device names.

To view mounted drives, simply run 'mount' with no arguments. fdisk -l will show all known block devices and their partitions, irrespective of their mount status.

--- rod.


All times are GMT -5. The time now is 06:11 PM.