在ubuntu10.04下,若开机进入字符界面则无法自动挂载windows硬盘。
首先可查看磁盘信息:
显示信息如下:
Disk /dev/sda: 160.0 GB, 160041885696 bytes-------我的硬盘信息
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc001c001
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1824 14651248+ 7 HPFS/NTFS
/dev/sda2 1825 19457 141637042 f W95 Ext'd (LBA)
/dev/sda5 1825 7296 43953808+ b W95 FAT32
/dev/sda6 7297 13375 48829536 b W95 FAT32
/dev/sda7 13376 13497 975872 82 Linux swap / Solaris
/dev/sda8 13497 13509 96256 83 Linux
/dev/sda9 13509 19458 47780864 83 Linux
Disk /dev/sdb: 4008 MB, 4008706048 bytes-------我的U盘信息
124 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6f20736b
#vi mount_windows.sh
- mount -t vfat /dev/disk/by-label/XURA_D /media/XURA_D -o iocharset=utf8
- mount -t vfat /dev/disk/by-label/XURA_E /media/XURA_E -o iocharset=utf8
若硬盘为ntfs格式的只需改为mount -t ntfs....(后同)
#chmod +x mount_windows.sh
执行mount_windows.sh即可挂载windows下的D盘和E盘(/media目录下没有XURA_D和XURA_E则新建一个)。
#vi mount_Udisk.sh
- mount -t vfat /dev/sdb /media/UDisk/ -o umask=000
#chmod +x mount_Udisk.sh
执行mount_Udisk.sh即可挂载U盘(/media目录下没有UDisk则新建一个)。
后记:写一个简单的脚步,挂载ntfs格式的d,e,f盘。
- #! /bin/sh
- dir_d=/media/disk_d
- dir_e=/media/disk_e
- dir_f=/media/disk_f
- a=`ls $dir_d | wc -l`
- b=`ls $dir_e | wc -l`
- c=`ls $dir_f | wc -l`
- echo "checking disk_d..."
- if [ $a -eq 0 ]; then
- echo "disk_d is not exsit,now creating..."
- sudo mount -t ntfs /dev/disk/by-label/software /media/disk_d
- else
- echo "disk_d exits"
- fi
- echo "checking disk_e..."
- if [ $b -eq 0 ]; then
- echo "disk_e is not exsit,now creating..."
- sudo mount -t ntfs /dev/disk/by-label/work /media/disk_e
- else
- echo "disk_e exits"
- fi
- echo "checking disk_f..."
- if [ $c -eq 0 ]; then
- echo "disk_f is not exsit,now creating..."
- sudo mount -t ntfs /dev/disk/by-label/elitor /media/disk_f
- else
- echo "disk_f exits"
- fi
阅读(5083) | 评论(0) | 转发(0) |