惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
GRAHAM CLULEY
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V2EX - 技术
V2EX - 技术
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
Webroot Blog
Webroot Blog
PCI Perspectives
PCI Perspectives
L
LINUX DO - 最新话题
Hacker News: Ask HN
Hacker News: Ask HN
N
News and Events Feed by Topic
H
Heimdal Security Blog
H
Help Net Security
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Jina AI
Jina AI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
F
Full Disclosure
小众软件
小众软件
S
Securelist
罗磊的独立博客
NISL@THU
NISL@THU
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cisco Blogs
云风的 BLOG
云风的 BLOG
C
CERT Recently Published Vulnerability Notes
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
S
Schneier on Security
D
DataBreaches.Net
M
MIT News - Artificial intelligence
V
Vulnerabilities – Threatpost
N
News and Events Feed by Topic
有赞技术团队
有赞技术团队
F
Fortinet All Blogs
T
Tenable Blog
The Register - Security
The Register - Security
C
Check Point Blog
AWS News Blog
AWS News Blog
Cloudbric
Cloudbric
C
CXSECURITY Database RSS Feed - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google Online Security Blog
Google Online Security Blog
博客园 - 叶小钗
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 司徒正美

博客园 - Donal

docker命令 NLP | 自然语言处理 - 语言模型(Language Modeling) windows: Python安装scipy,scikit-image时提示"no lapack/blas resources found"的解决方法 Sense2vec with spaCy and Gensim python 去停用词 nohup command > myout.file 2>&1 & NLTK vs SKLearn vs Gensim vs TextBlob vs spaCy Gensim进阶教程:训练word2vec与doc2vec模型 Gensim入门教程 使用pdb调试python git只clone仓库中指定子目录 转:深度学习与自然语言处理之五:从RNN到LSTM 转:如何构建爬虫代理服务? RHEL7下安装使用TensorFlow和kcws RHEL7 -- Linux搭建FTP虚拟用户 解决windows10搜索不到内容的问题 forward和redirect 的区别 Spring注解 100 open source Big Data architecture papers for data professionals
RHEL7磁盘分区挂载和格式化
Donal · 2016-02-29 · via 博客园 - Donal

安装大数据平台,每台机器需要挂载10个磁盘,用JBOD模式,操作系统为RHEL7.2。

写了两个脚本,format_disk.sh和mount_disk.sh实现磁盘自动分区格式化以及挂载,修改fstab。

format_disk.sh

#!/bin/bash
disks=(sdb sdc sdd sde sdf sdg sdh sdi sdj sdk)
for ((i=0;i<${#disks[*]};i++))
do
  mounted=`mount|grep "/mnt/${disks[i]}"`
  if [ "$mounted" ] ; then
    echo "umount /mnt/${disks[i]}"
    umount /mnt/${disks[i]}
  fi
  echo "make partition /dev/${disks[i]}"
  parted -s /dev/${disks[i]} mklabel gpt
  parted -s /dev/${disks[i]} mkpart primary xfs 0% 100%
  echo "format disk /dev/${disks[i]}"
  mkfs.xfs -f -L ${disks[i]} /dev/${disks[i]}
done
echo -n "reboot?"
read ANS
case $ANS in
y|Y|yes|Yes)
  echo "run mount_disk.sh after rebooting"
  reboot
  ;;
n|N|no|No)
  exit 0
  ;;
esac

mount_disk.sh

#!/bin/bash
rm -f fstab
cp /etc/fstab . -f
cat fstab
>fstab.new
sed -e '/\/mnt\/sd/d' fstab > fstab.new
cat fstab.new
disks=(sdb sdc sdd sde sdf sdg sdh sdi sdj sdk)
for ((i=0;i<${#disks[*]};i++))
do
  mounted=`mount|grep "/mnt/${disks[i]}"`
  if [ "$mounted" ] ; then
    echo "umount /mnt/${disks[i]}"
    umount /mnt/${disks[i]}
  fi
  if [ ! -d "/mnt/${disks[i]}" ]; then
    mkdir /mnt/${disks[i]}
  fi
  UUID=`lsblk -f /dev/${disks[i]}|grep "^${disks[i]} " |awk '{print $4}'`
  if [ "$UUID" ]; then
    echo "write partition to fstab.new"
    echo "UUID=${UUID} /mnt/${disks[i]}    xfs         defaults 0 0" >> fstab.new
  fi
done
cat fstab.new
echo -n "use this for /etc/fstab?"
read ANS
case $ANS in
y|Y|yes|Yes)
  cp fstab.new /etc/fstab -f
  mount -a
  mount
  ;;
n|N|no|No)
  exit 0
  ;;
esac