mount
Posted tengfei520
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mount相关的知识,希望对你有一定的参考价值。
#!/bin/bash if [ $# -le 1 ]; then echo -e "usage : \n\t$0 sdx mount_point" echo -e "example: \n\t$0 sdb /data1" exit 1 fi disk=/dev/$1 homedisk_num=$(df -h | awk ‘{print $NF}‘ | grep -c "$2") if [[ $homedisk_num -gt 0 ]]; then echo "$2 has mounted on single-disk ." touch /tmp/home_init.tag2 exit 0 fi disk_num=$(df -h | awk ‘{print $1}‘ | grep -c "$1") if [[ $vdb1_num -gt 0 ]]; then echo "$1 has mounted on single-disk ." touch /tmp/home_init.tag2 exit 0 fi parted -s "$disk" mklabel msdos parted -s "$disk" mkpart primary 0% 100% #label=‘home‘ echo "__CMD: time mkfs.ext4 -L $label ${disk}1 > ‘/tmp/mkfs.${label}.txt‘ 2>&1 &" time mkfs.ext4 -L "$label" "${disk}1" UUID=$(blkid -o value -s UUID "${disk}1") echo "UUID=${UUID} $2 ext4 defaults,noatime 0 0" >> /etc/fstab #mount ${disk}1 /mnt || { echo "__ERROR: ‘mount ${disk}1 /mnt‘ FAILED, exit 2"; exit 2; } #rsync -avP /home/ /mnt --exclude=‘/home/work/mesos/log/*‘ --exclude=‘/home/work/mesos/slave/*‘ #umount /mnt cat /etc/fstab mount -a
以上是关于mount的主要内容,如果未能解决你的问题,请参考以下文章
mount命令的用法,以及技巧光盘镜像文件移动硬盘及U盘的方法