Monday, September 20, 2021
In the last post we created a new partition for a new disk that we've just added, in this post we are going to mount the partition and create a filesystem for the partition so that we can use it. First lets check to see that we have a new partition by running the fdisk -l command
As you can see a new partition called /dev/sdb1 has been created with 8 GB of disk space. Now we all good to go.
Here are the steps to mount and create a file system in Linux:
1. First we need to create a filesystem so that the Linux system can read and write to it. Linux uses the xfs filesystem so that's what we are going to use. To do that we have to run the mkfs command. To make an xfs filesystem you simply type mkfs.xfs /dev/sdb1
2. Now that we have a filesystem that Linux could understand, it is time to mount the partition so that we could use in our server. It's a two step process to accomplish that, first you have to create a directory, type mkdir /data to create /data directory. Then you are going to mount the partition to that directory with this command mount /dev/sdb1 /data now if you run the command df -h you will see the partition has been mounted to the /data director
3. We still have one more step before we are finished. Everything will work like it should, but once you reboot the settings will not persist in it's current state. To make the settings persist we have to edit the fstab file. So type the command vi /etc/fstab make sure you have your system backed up and you can revert back because if you messed up you will not be able to log in. When you are in the fstab file type in the following line at the end of the file
/dev/sdb1 /data xfs defaults 0 0
No comments:
Post a Comment