Browse - Computer Tips - Linux: prepare new disk on the command line

Date: 2019aug8

Q.  Linux: prepare new disk on the command line

A.  As root...

Use fdisk to partition it

fdisk /dev/sda Replace with your actual disk n Use the `n` command an accept defaults w Ask to have it written q Quit
Format it as ext4
mkfs.ext4 /dev/sda3 Change to your actual partition
Make a mount point
mkdir /stuff
Find its UUID (Unique ID)
blkid /dev/sda3
The result will be something like
/dev/sda3: UUID="fd26215f-132b-4c5a-a511-123456789012" TYPE="ext4"
Add a line to /etc/fstab with the UUID:
UUID=fd26215f-132b-4c5a-a511-123456789012 /stuff ext4 defaults 1 2
Mount it
mount /stuff
Check it
df -h