check_home=`df -lh | grep /dev/vdb1 | grep home`

if [ ${#check_home} -gt 20 ]; then
    echo "dev/vdb1 /home exist !"
    exit 0
fi

#begin part disk
fdisk /dev/vdb << EOF
n
p
1


wq
EOF

#ext4 format
mkfs.ext4 /dev/vdb1

if [ `grep -c "/home" /etc/fstab` -eq '0' ]; then
    echo '/dev/vdb1     /home   ext4    defaults        0 0' >> /etc/fstab
fi

mkdir -p /opt/newhome
cp -avx /home/* /opt/newhome/
mount /home
cp -avx /opt/newhome/* /home/

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-06
  • 2021-09-02
  • 2021-10-17
猜你喜欢
  • 2022-01-12
  • 2022-12-23
  • 2021-09-13
  • 2022-02-13
  • 2022-12-23
  • 2021-08-20
相关资源
相似解决方案