#!/usr/bin/python
#coding=utf-8
'''
Created on Nov 4, 2015
install basic system [c2]
@author: Galbraith
'''
from subprocess import call
from os.path import basename
import os
import sys
import commands
def scall(cmd_line):
'''linux shell '''
return call(cmd_line,shell=True)
def findstrinfile(filename, lookup):
'''file str differ check'''
return lookup in open(filename,'rt').read()
def file_check(file_sl):
'''file differ check'''
return os.path.isfile(file_sl)
def dir_check(dir_sl):
'''dir differ check'''
return os.path.exists(dir_sl)
def srun(comm):
'''system command'''
return os.system(comm)
def mount_disk():
'''mount new disk'''
srun('mkdir /data')
srun('mkfs -t ext4 /dev/vdb')
srun('mount /dev/vdb /data')
srun('echo "/dev/vdb /data ext4 defaults 0 0" >> /etc/fstab')
def cat_mount():
mount = commands.getoutput('mount -v')
lines = mount.split('\n')
points = map(lambda line: line.split()[2], lines)
srun('df -h')
print points
def handle():
mount_disk()
cat_mount()
if __name__ == '__main__':
handle()
挂载磁盘脚本
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
cmd检测服务是否存在
chcp
Java