Linux   « Apache 2 - WWW server | HOME | Apache + SSL (HTTPS) »

 ■ USB memory stick

How to mount USB memory stick on Linux

# dmesg
# lsusb

Then you know as which device USB memory is mapped.

Basically, it is recognized as SCSI device like sda, sdb, sdc...


Mount
# mount /dev/sda1 /mnt/flash

or if you wanna specify more,

# mount -t vfat -o rw,sync,iocharset=utf8,codepage=932 /dev/sda1 /mnt/flash

sync = sync option (unnecessary)
rw = enable write
iocharset = system charset
codepage = charset in flash memory


Unmount
# umount /mnt/flash


If USB memory stick is always connected to PC and want to map it automatically when reboot. (in case for External HD, connected by USB)
# pico /etc/fstab
/dev/sda1 /mnt/backup ext3 defaults 1 2

(If you mistyped fstab and the system does not boot up, try inserting the installation CD and type linux rescue. Then you can rectify it.)


If you cannot unmount
In case that you tried to unmount your HDD, but you cant do it with the error mentioned below.

"Device is busy."

It means the other process is using this HDD, thats why you cannot unmount.
In this case, you can check which process is using this HDD with fuser.

# fuser -muv /mnt/backup

Then you can stop the process like below. In this case, Samba was using this HDD.

# /etc/init.d/smb stop

If the process is not registered under /etc/init.d/ and want to stop is manually, you need to check what is process ID for it.

# ps ax | grep smb

Then now you found out the process ID, and take below command to stop the process.

# kill "process ID"
or
# kill -9 "process ID"

投稿者 tomopugh : 2007年03月12日 17:51

Comment

Please comment !




Save the info?


  (Please don't click on "post" twice. It takes time a bit to change to the next screen!!)