Friday, August 10, 2012

What is the device name for mount

When you insert your SD card or USB drive to a system, there will be some kernel message, but you may or may not see the message depends on what UI or tty you're at. You know you need to mount it, if not auto mounted, but you don't know what is the device name, you can try the following:

Before you insert your SD card or USB drive
# cat /proc/partitions
This will show you the existing partitions. Now insert your SD Card or USB drive, wait until the kernel message is done, or wait 5-10 secs to make sure your kernel complete recognizing your drive.
# cat /proc/partitions
You should see something new like sdb or mmcblk0p1. Check your /dev to see the device node is already exist. If not, uses the device major and minor name showed in /proc/partitions, create it using mknod command:
# mknod /dev/<device name> b <major> <minor>
Then you can create your mount point e.g. mkdir /mnt/sdcard or /mnt/usb_driver and mount your partiton
# mount /dev/<device name> /mnt/<mount point>
Then you should be able to read your drive.  If /proc/partitions fails to show up, I would suspect something is wrong with your SD card or USB drive, or something to do with the driver.

No comments: