From c6e34a4c462e43b4a1a5a42d02a774138370b75e Mon Sep 17 00:00:00 2001 From: xiaosuGW Date: Fri, 16 Jul 2021 21:23:53 -0500 Subject: [PATCH] upload add_partition.sh and install_docker.sh --- add_partition.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++ install_docker.sh | 8 +++++++ 2 files changed, 63 insertions(+) create mode 100755 add_partition.sh create mode 100755 install_docker.sh diff --git a/add_partition.sh b/add_partition.sh new file mode 100755 index 0000000..84dca35 --- /dev/null +++ b/add_partition.sh @@ -0,0 +1,55 @@ +#/bin/bash + +setVim(){ +echo "hi comment ctermfg=3 +set hlsearch + +if has(\"autocmd\") + au BufReadPost * if line(\"'\\\"\") > 1 && line(\"'\\\"\") <= line(\"$\") | exe \"normal! g'\\\"\" | endif +endif + +" > ~/.vimrc +} + +setVim + +#remember github username and password +git config --global credential.helper store + +do_partition() { +echo "doing partition" +echo "n +p +1 + ++400G +w +" | sudo fdisk /dev/sdb && sleep 4 && sudo mkfs.ext4 /dev/sdb1 +} + +add_partition() { + has_sdb=`sudo fdisk -l /dev/sdb|grep "/dev/sdb: 1.9 TiB"` + no_partition=`sudo fdisk -l /dev/sdb|grep "Device"` + #echo $has_sdb + if [[ $has_sdb == *"Disk /dev/sdb: 1.9 TiB"* ]]; then + if [ -z "$no_partition" ]; + then + do_partition + else + echo "/dev/sdb already has paritions" + exit + fi + else + echo "no /dev/sdb or its capacity is not 1.1 TiB" + exit + fi +} + +mount_partition() { + sudo mkdir /my_mount + sudo mount /dev/sdb1 /my_mount + df -h +} +add_partition +mount_partition +sudo chmod 777 /my_mount diff --git a/install_docker.sh b/install_docker.sh new file mode 100755 index 0000000..4ab92d9 --- /dev/null +++ b/install_docker.sh @@ -0,0 +1,8 @@ +sudo apt-get update +sudo apt install docker.io +sudo service docker stop +sudo mv /var/lib/docker /my_mount +sudo ln -s /my_mount/docker /var/lib/docker +sudo service docker restart +sudo docker -v +