Skip to content

Instantly share code, notes, and snippets.

@johngrimes
Last active August 29, 2015 13:56
Show Gist options
  • Save johngrimes/8838703 to your computer and use it in GitHub Desktop.
Save johngrimes/8838703 to your computer and use it in GitHub Desktop.
Format and mount a new filesystem in Linux
# Get the device identifier of the device, which is the one that currently does not have a valid partition table.
fdisk -l
# Use fdisk to create a new primary Linux partition, which takes up all of the available space.
fdisk /dev/sdb
# Make a new ext4 filesystem within the new partition.
mkfs -t ext4 /dev/sdb1
# Get the UUID of the new filesystem.
blkid /dev/sdb1
# Add a new line to /etc/fstab (see other file).
vim /etc/fstab
# Mount the new filesystem.
mount /data
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /data ext4 errors=remount-ro 0 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment