Howto: USB-Stick mounten mit Gentoo
Inhaltsverzeichnis |
Kernel Konfigurieren
Zuerst erstmal checken ob der Kernel ok ist.
| Datei: Kernel 2.4 |
SCSI support --->
<*> SCSI support
--- SCSI support type (disk, tape, CD-ROM)
<*> SCSI disk support
File systems --->
<*> DOS FAT fs support
<*> MSDOS fs support
< > UMSDOS: Unix-like file system on top of standard MSDOS fs
<*> VFAT (Windows-95) fs support
USB support --->
<*> Support for USB
<*> UHCI (Intel PIIX4, VIA, ...) support
<*> OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support
<*> USB Mass Storage support
|
Loggfiles überprüfen
wenn der Kernel nach den Reboot beim einstecken des Sticks etwas in dieser Art anzeigt ist alles ok:
|
tail -f /var/log/messages tail -f /var/log/messages Feb 26 00:00:01 gentoo /usr/sbin/cron[14320]: (root) CMD (rm -f /var/spool/cron/lastrun/cron.hourly) Feb 26 00:17:53 gentoo usb 2-1: USB disconnect, address 2 Feb 26 00:17:56 gentoo usb 2-1: new full speed USB device using address 3 Feb 26 00:17:56 gentoo scsi1 : SCSI emulation for USB Mass Storage devices Feb 26 00:17:57 gentoo Vendor: GENERIC Model: USB Disk 2.0 Rev: U204 Feb 26 00:17:57 gentoo Type: Direct-Access ANSI SCSI revision: 02 Feb 26 00:17:57 gentoo USB Mass Storage device found at 3 Feb 26 00:17:57 gentoo scsi.agent[22536]: disk at /devices/pci0000:00/0000:00:11.3/usb2/2-1/2-1:1.0/host1/1:0:0:0 Feb 26 00:17:57 gentoo SCSI device sda: 253952 512-byte hdwr sectors (130 MB) Feb 26 00:17:57 gentoo sda: assuming Write Enabled Feb 26 00:17:57 gentoo sda: assuming drive cache: write through Feb 26 00:17:57 gentoo SCSI error: host 1 id 0 lun 0 return code = 8000002 Feb 26 00:17:57 gentoo Sense class 7, sense error 0, extended sense 7 Feb 26 00:17:57 gentoo sda: sda1 Feb 26 00:17:57 gentoo Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0 |
USB Stick mounten
Probehalber mal den Stick mounten:
mkdir /mnt/usbstick mount -t vfat /dev/sda1 /mnt/usbstick |
/etc/fstab editieren
Damit der Stick auch nach einem reboot gemountet wird, muss man in der /etc/fstab noch einen Eintrag hinzufügen.
| Datei: /etc/fstab |
/dev/sda1 /mnt/usbstick vfat noauto,user,exec 0 0 |
Adding symlink via udev
Using udev, you can make sure that no matter what order you plugin usb drives, it always is at /dev/usbdrive (or whatever you want)
First, find the ID of your usb drive by using /sys: (assuming the device is currently in /dev/sda)
udevinfo -a -p `udevinfo -q path -n /dev/sda` or better
udevinfo -a -p `udevinfo -q path -n /dev/sda` | grep SYSFS{serial}
|
One of the values that gets outputed, atleast on my device is 'SYSFS{serial}="0402170100000020EB5D00000000000"'. We can use serial numbers like this to make rules in udev, so make a /etc/udev/rules.d/10-local.rules if you don't already have one, and put a line similar to this:
| Datei: /etc/udev/rules.d/10-local.rule |
BUS="usb", SYSFS{serial}="0402170100000020EB5D00000000000", KERNEL="sd?1", NAME="%k", SYMLINK="usbdrive"
|
Now, accoding to this example, that usb drive should always show up in /dev/usbdrive (feel free to modify the rule if you have multiple partitions on your drive).