Mounting USB Drives
Mounting USB drives
To mount a drive type:
- mount /dev/sda1 /mnt/usbstorage
To unmount type:
- umount /mnt/usbstorage
You can also create the following simple script to automatically mount USB drives or use the more advanced usb-storage that I've written. Here is the simple version:
# su # vi /etc/hotplug/usb/usb-storage #!/bin/sh . /etc/hotplug/hotplug.functions if [ ! -L /var/run/usb/%proc%bus%usb%* ]; then mesg Try to Mount mount /mnt/usbstorage if [ $? = 0 ]; then ln -s /mnt/usbstorage /home/samba/USB_Storage ln -s /etc/hotplug/usb/usb-storage.off $REMOVER mesg make REMOVER in $REMOVER fi fi # chmod 755 /etc/hotplug/usb/usb-storage # vi /etc/hotplug/usb/usb-storage.off #!/bin/sh . /etc/hotplug/hotplug.functions mesg Removing /mnt/usbstorage rm /home/samba/USB_Storage umount /mnt/usbstorage # chmod 755 /etc/hotplug/usb/usb-storage.off # echo "/dev/sda1 /mnt/usbstorage vfat noauto,umask=000,noatime,iocharset=utf8,codepage=932 0 0" >> /etc/fstab
Hint: Once a USB disk is mounted, it will appear in the Files tab as well. In addition, creating a link to the mounted drive from /home/samba will allow it to be shared as well through Samba. In general, most devices such as memory sticks, cameras, mp3 players and usb harddrives have their disk partitioned as a primary partition and can be found at /dev/sda1. However, if you have partitioned your disk as an extended partition, then it most likely would be /dev/sda5. Do a fdisk -l /dev/sda as root to check and change the above accordingly.
In addition, if you are using a USB Hub, then you will be able to attach and mount multiple devices, usually up to four disks. In such a case, the devices will be /dev/sda, /dev/sdb, /dev/sdc and /dev/sdd. I have created a more advanced script which can automatically mount up to four usb disks and also automount disks partitioned as primary or extended partitions. Place this usb-storage into /etc/hotplug/usb and remove usb-storage.off if there already is one (it will generate a new one). The script will also create mount points under /mnt and update /etc/fstab as required. Alternatively, you can simply install [automounter-c3000_0.3_arm.ipk].
The C3000 can also read NTFS formatted USB disks. You will need to copy ntfs.o to /lib/modules/2.4.20/kernel/fs/ntfsfs/ or install [ntfs-zaurus_2.4.20_arm.ipk].