Skip to content

Instantly share code, notes, and snippets.

@yogeek
Created January 3, 2018 15:10
Show Gist options
  • Save yogeek/0a3504af089f15134cbf77750f0fb79f to your computer and use it in GitHub Desktop.
Save yogeek/0a3504af089f15134cbf77750f0fb79f to your computer and use it in GitHub Desktop.
Disk management
# Adapted from <https://superuser.com/questions/332252/creating-and-formating-a-partition-using-a-bash-script>
(
echo d # Delete sda2 partition table
echo 2 # Default = sda2
echo n # Add a new sda2 partition
echo p # Primary partition
echo 2 # Partition number
echo # First sector (Accept default: 2099200)
echo # Last sector (Accept default: varies, e.g 104857599)
echo t # Tag partition
echo 2 # Default = sda2
echo 8e # Type "Linux VM"
echo w # Write changes
) | sudo fdisk /dev/sda
# REBOOT !
pvresize /dev/sda2
lvextend -L +5G /dev/mapper/vg_root-lv_home
xfs_growfs /home
lvcreate -L 25G -n lv_data vg_root
mkfs.xfs /dev/vg_root/lv_data
mkdir /data
mount -t xfs /dev/vg_root/lv_data /data
echo "/dev/mapper/vg_root-lv_data /data xfs defaults 0 0" >> /etc/fstab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment