Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- for i in $(fdisk -l | grep -i 'Disk /dev/sd*' | awk '{print $2}'| sed 's/://' | sort );
- do
- disk_size=$(fdisk -l | grep 'Disk /dev/sd*' | grep ${i} | awk '{print $3}')
- disk_capacity=$(fdisk -l | grep -i 'disk /dev/sd*' | grep ${i} |awk '{print $4}'|sed 's/,//')
- sleep 3
- case $disk_capacity in
- TiB | TB)
- parted -s ${i} mklabel gpt
- parted -s ${i} -a min mkpart primary xfs 0 ${disk_size}TB
- ;;
- GiB | GB)
- parted -s ${i} mklabel msdos
- parted -s ${i} -a min mkpart primary xfs 0 ${disk_size}GB
- ;;
- *)
- echo -n "Check the Disk partition"
- ;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement