码迷,mamicode.com
首页 > 其他好文 > 详细

mount

时间:2017-11-16 13:31:39      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:example   exit   error   err   ext   awk   dos   mes   led   

#!/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

标签:example   exit   error   err   ext   awk   dos   mes   led   

原文地址:http://www.cnblogs.com/tengfei520/p/7843411.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!