Skip to content

Instantly share code, notes, and snippets.

@shivai
Created March 7, 2019 15:14
Show Gist options
  • Save shivai/ebfb441e1d46617ca72a4241ead16d3a to your computer and use it in GitHub Desktop.
Save shivai/ebfb441e1d46617ca72a4241ead16d3a to your computer and use it in GitHub Desktop.

Add a new disk and mount it

After adding a disk to linux you should do these steps to use it:

fdisk -l

You can see the your new disk and take its name then:

fdisk /dev/sdb

then press n and after that press enter for 3 steps later and finally press w to write the changes. Now yu can run the following command:

fdisk -l

and see that your disk is ready to use. In this step we want make partition on it:

mkfs.xfs /dev/sdb1

This command make xfs the disk you can use other formats like:

mkfs.ext4

now for mounting yu should do this:

blkid /dev/sdb1

then copy the UUID from output and:

nano /etc/fstab

and write these end of the file:

UUID=xxxxxxxxxxxx /var/lib/postgresql defaults,noatime 0 0

then run:

mount -a

this command run the fstab file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment