Utilize shell scripts,linux commands, open source tools,java, to Maximize the Power of Linux.
Focused on working with linux and shell, search engine technology including Chinese segmenter
Any questions please contact me at gmail: david.ullua

2/04/2007

使用fdisk -l 快速查找可用的移动设备(移动硬盘,优盘,SD/MMC卡等)

插入移动硬盘或者优盘以后,对于不一样的USB设备,不一样的机器,移动硬盘(或优盘)在系统中的设备标识(/dev目录下的链接)都是不一样的。

有时候是在/sdb1下面,有时候是在/sdc1, 或者/sda5下,也可能是其他的路径标识。在尝试了"mount /dev/sdxn /mnt/udisk" 3次,5次都没有找到后,任何人都可能感觉到泄气。

其实在我们可以用fdisk -l (注意是小写的-L,list的意思) 命令查看系统的所有存储设备信息。fdisk是磁盘格式化工具,所以在磁盘,包括移动存储设备还没有mount的时候,就可以检测到这些设备。

下面是我的电脑插上优盘约30秒(接上优盘后,会有片刻的检测时间)后,运行fdisk -l的结果:
Disk /dev/sda: 512 MB, 512229376 bytes
9 heads, 8 sectors/track, 13895 cylinders
Units = cylinders of 72 * 512 = 36864 bytes

Device Boot Start End Blocks Id System
/dev/sda1 4 13896 500107+ 6 FAT16

Disk /dev/hda: 80.0 GB, 80023182848 bytes
255 heads, 63 sectors/track, 9728 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1736 13944388+ 7 HPFS/NTFS
/dev/hda2 1737 9729 64203772+ f W95 Ext'd (LBA)
/dev/hda5 1737 2884 9221278+ b W95 FAT32
/dev/hda6 2885 3648 6136798+ 83 Linux
/dev/hda7 3649 8512 39070048+ 7 HPFS/NTFS
/dev/hda8 * 8513 9156 5172898+ 83 Linux
/dev/hda9 * 9157 9666 4096543+ 83 Linux
/dev/hda10 9667 9729 506016 82 Linux swap

这里可以看到/dev/sda1是有盘,可以mount /dev/sda1 /mnt/udisk加载u盘。

No comments:

About Me

I am a senior developer and a team leader with 3 years development experience in Suzhou, China, focus on mobile web search, linux, Java and machine learning in NLP (natural language processing). My goal is to improve people's life with computer technology.