当前位置: 技术问答>linux和unix
debian下如何通过程序知道U盘已经挂载了
来源: 互联网 发布时间:2016-07-26
本文导语: RT | mount + grep? | 再mount一下? | [root@h88 fronw-wui]# fdisk -l Disk /dev/sda: 160.0 GB, 160040803840 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 ...
RT
|
mount + grep?
|
再mount一下?
|
[root@h88 fronw-wui]# fdisk -l
Disk /dev/sda: 160.0 GB, 160040803840 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1530 12289693+ 7 HPFS/NTFS
/dev/sda2 1531 19457 143998627+ f W95 Ext'd (LBA)
/dev/sda5 1531 3953 19462716 b W95 FAT32
/dev/sda6 3954 6376 19462716 b W95 FAT32
/dev/sda7 6377 18945 100960461 83 Linux
/dev/sda8 18946 19457 4112608+ 82 Linux swap / Solaris
从这里找
|
所有挂载的目录都会在/proc/mounts文件中显示
下面一断Shell脚本,是我以前写的卸载分区用的。可以看下
#! /bin/sh
disk=`cat /proc/mounts | sed -n '/^/dev/[sh]da/p' |
awk '{print $2}' | sort -r`
#echo $disk
for point in $disk
do
echo `umount $point`
done
下面一断Shell脚本,是我以前写的卸载分区用的。可以看下
#! /bin/sh
disk=`cat /proc/mounts | sed -n '/^/dev/[sh]da/p' |
awk '{print $2}' | sort -r`
#echo $disk
for point in $disk
do
echo `umount $point`
done