问题:U盘接入,系统可以识别,但在/dev目录下只有sda(或其他),却无设备节点sda1(或其他)?
解决:
(1)查看U盘是否分区
#fdisk /dev/sda /*进入fdisk命令操作空间*/
#Command (m for help): m /*命令查看*/
Command action
a toggle a bootable flag #设置引导扇区
b edit bsd disklabel #编辑卷标(linux下使用的卷标bsd通用)
c toggle the dos compatibility flag
d delete a partition #删除分区
l list known partition types #列出已知的分区类型
m print this menu
n add a new partition #添加一个新的分区
o create a new empty DOS partition table #生成一个新的空DOS分区列表
p print the partition table #打印分区列表
q quit without saving changes #不保存退出
s create a new empty Sun disklabel
t change a partition's system id #改变一个分区列表的ID
u change display/entry units
v verify the partition table
w write table to disk and exit #写入列表到磁盘并退出
x extra functionality (experts only)
#Command (m for help): p
Disk /dev/sda: 8178 MB, 8178892800 bytes
252 heads, 62 sectors/track, 1022 cylinders
Units = cylinders of 15624 * 512 = 7999488 bytes
Device Boot Start End Blocks Id System /*可见U盘无分区*/
(2)若未分区,创建分区sda1,并格式化(也可以不进行格式化)
#fdisk /dev/sda
Command (m for help): m
Command Action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n /*n表示添加一个新的分区*/
Command action
e extended /*创建扩展分区*/
p primary partition (1-4) /*创建主分区*/
p
Partition number (1-4): 1 /*输入主分区号,这里设置为1*/
First cylinder (1-1022, default 1): Using default value 1 /*起始,回车使用默认值*/
Last cylinder or +size or +sizeM or +sizeK (1-1022, default 1022): Using default value 1022 /*结尾,回车使用默认值*/
Command (m for help): p /*p表示打印分区列表*/
Disk /dev/sda: 8178 MB, 8178892800 bytes
252 heads, 62 sectors/track, 1022 cylinders
Units = cylinders of 15624 * 512 = 7999488 bytes
Device Boot Start End Blocks Id System /*可见sda1分区已创建*/
/dev/sda1 1 1022 7983833 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table
#mkfs -t vfat /dev/sda1 /*对sda1进行格式化(也可以不进行这一步)*/
mkfs.vfat 3.0.12 (29 Oct 2011)
mkfs.vfat: /dev/sda1 contains a mounted file system.
#fsck -t vfat /dev/sda /*格式化完成后对U盘进行修复*/
fsck from util-linux 2.20.1
dosfsck 3.0.12, 29 Oct 2011, FAT32, LFN
Logical sector size (64543 bytes) is not a multiple of the physical sector size.
(3)前两步完成后,在/dev目录下将会出现设备节点sda1;如果没有,则手动创建设备节点sda1
#mknod /dev/sda1 b 8 1 /*手动创建设备节点sda1*/
#mount /dev/sda1 /mnt/udisk /*挂载U盘到/mnt/udisk目录下*/
#umount /mnt/udisk /*卸载U盘*/