Skip to content

Instantly share code, notes, and snippets.

@madsonic
Last active December 2, 2019 03:17
Show Gist options
  • Save madsonic/8bd29ff943caadcbc920e1eda9dcb91e to your computer and use it in GitHub Desktop.
Save madsonic/8bd29ff943caadcbc920e1eda9dcb91e to your computer and use it in GitHub Desktop.
volume modification
# see existing filesystem
# if no fs, 'data' will be shown
sudo file -s /dev/xvdf
# make fs
mkfs.ext4 /dev/sdb
mkdir /mnt/a
# mount it onto a directory
mount /dev/sdb /mnt/a
# get block UUID for fstab
blkid
# or use fstab for automated mount
# that will persist restarts
# edit /etc/fstab
# then run mount -a
#<device> <dir> <type> <option> <dump> <fsck>
/dev/sdb /mnt/a ext4 defaults,discard 0 0
# list block device
lsblk
# disk usage
df -h
# when growing, it is important to grow the partition first before resizing the filesystem
# grow partition
growpart <partition> <partition number>
# extend the file system
resize2fs <volume>
# when shrinking, do the opposite, resize then shrink partition
resize2fs <volume> <size>
# remap partition
parted resizepart <number> <end>
https://wiki.archlinux.org/index.php/Fstab
https://wiki.archlinux.org/index.php/Parted
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment