Created
June 1, 2014 16:05
-
-
Save jacobsalmela/5876115cafff2dea8eb3 to your computer and use it in GitHub Desktop.
Partitions the disk for putting /Users on a separate partition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#----------VARIABLES--------- | |
echo "Checking hard disk ID..." | |
hardDiskID=$(diskutil list | awk '/GUID_partition_scheme/ {print $5}') | |
#---------------------------- | |
#-----------SCRIPT----------- | |
#---------------------------- | |
echo "Checking if Users partition exists..." | |
# List the disks available and grep for Users | |
diskutil list | grep "Users HD" | |
# If the last command exits with status 1 (failed--meaning no Users partition was found), then | |
if [ $? = 1 ];then | |
echo -e "Creating Users and Recovery partitions...\n" | |
# Partition the disk with three partitions using GPT | |
# The first should be JHFS+, named Macintosh HD, and use the first 30% of the disk | |
# The second should be the same as above, but use 68% | |
# The last partition should use the Remainder of the disk | |
diskutil partitionDisk $hardDiskID 3 GPT JHFS+ "Macintosh HD" 30% JHFS+ "Users HD" 68% JHFS+ "Recovery HD" R; | |
else | |
echo "Users partition already exists...no changes made." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment