thursday tip day on usb keys at the linux command line
How to mount a USB stick in Ubuntu server using the command prompt only:
Do a sudo tail -f /var/log/syslog and plug the usb drive in. Look for lines like these: Feb 18 12:58:32 shuchi kernel: [17192272.616000] sda: assuming drive cache: write through Feb 18 12:58:32 shuchi kernel: [17192272.616000] sda: sda1
Make a directory in /media named usbdrive. Mount it like this: sudo mount /dev/sda1 /media/usbdrive
To unmount before ejecting: sudo umount /media/usbdrive
If you get a message saying that the device is busy you can find out what process is using it using with the fuser command, with the -u parameter to see which user it is:
fuser -u /media/usbdrive
This will give you a number which refers to a process, and a user, then run ps -A to list all the processes and see which one it is. If you need to kill that process (USE WITH CAUTION) then run:
sudo kill -9 yourprocessnumber
You should then be able to safely unmount your USB drive