Format and mount the volume
List the available disk devices and their mount points
lsblk
The nvme1n1 volume is not yet mounted
Create a partition on the volume
List the existing partitions
fdisk -l
Create a new partition
fdisk /dev/nvme1n1
# enter n to create a new partition and follow the defaults to maximize the drive space used
# enter p tp view the partition table
# enter w to write the partition table to the disk
Check the partition list
lsblk
Detect the new partition with
partprobe
If there is a file system on the partition to determine the file system of the volume
file -s /dev/nvme1n1p1
“data” means no file system
If there is no file system on the volume, create one
mkfs -t xfs /dev/nvme1n1p1
# If the partition already has a files system and you want to overwrite it use the xfs -f option
mkfs -t xfs -f /dev/nvme1n1p1
If the mkfs tool is not found, install it with yum install xfsprogs
Create a mount point
Create a directory where the volume will be mounted
mkdir /data
Mount the volume to the directory
mount /dev/nvme1n1p1 /data
Automatically mount the volume after reboot
The mounting above will not be retained after a reboot. To keep the volume mounted after a reboot add am entry to the /etc/fstab file
Make a safety copy of the original fstab file
cp /etc/fstab /etc/fstab.orig
Use blkid to find the UUID of the device
blkid
# On Ubuntu 18.04
lsblk -o +UUID
Open the /etc/fstab file in an editor
vim /etc/fstab
Add an entry to the /etc/fstab file for the volume
UUID=7c6cb20b-ada0-4cd7-9c3a-342d6faf87a2 /data xfs defaults,nofail 0 2
- UUID
- Mount point
- file system
- recommended file system mount options. The nofail option will allow this server to boot even if the volume is not available. On Debian derivatives, including earlier than Ubuntu 16.04 nobootwait is also necessary
To test if the file entry is correct unmount the volume and use the /etc/fstab to mount it again
umount /data
mount -a
If there are no errors, the file should be correct.
To list the directory sizes
du -sh *
To empty a file
cat /dev/null > ./MY_LARGE_LOG_FILE
Check the load on the computer
uptime
23:58:50 up 318 days, 16:32, 1 user, load average: 0.03, 5.34, 18.68
The load averages are from the past 1, 5, and 15 minutes