# Partitioning the HDD storage on CentOS based OS

### 1. SSH into your server

Start by connecting to your server via SSH. If you've used SSH keys, please take a look at the following article: [How to SSH into your server using SSH keys](https://docs.crunchbits.com/system-administration/ssh-keys/how-to-ssh-into-your-server-using-ssh-keys)

### 2. Find the HDD disk

Next up, you'll have to find the HDD disk. You can do this by executing the following command:

```
lsblk
```

And you'll be presented with an output similar to the one below:

```
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda      8:0    0  368K  1 disk 
sr0     11:0    1 1024M  0 rom  
vda    252:0    0   14G  0 disk 
├─vda1 252:1    0    1M  0 part 
├─vda2 252:2    0  128M  0 part /boot/efi
└─vda3 252:3    0 13.9G  0 part /
vdb    252:16   0    2T  0 disk 
```

Within that output, looks at the capacities of the drives to determine which disk the your HDD one. In our case, it's a 2TB one, which is the `vdb` one. Please either remember this, or note this down somewhere.&#x20;

### 3. Format the drive

Next up, you'll have to format the drive to the `ext4` format with the following command:

{% hint style="info" %}
Change `vdX` to the name of the drive above
{% endhint %}

```
mkfs.ext4 /dev/vdX
```

### 4. Mount the drive

Afterward, please make a new directory, where you'll mount your disk:

```
mkdir /hdd
```

Then mount that formatted drive there:

```
mount /dev/vdX /hdd
```

Then verify that it's mounted via:

```
df -h
```

The output of that command should have a line similar to the following:

```
/dev/vdb        2.0T   28K  1.9T   1% /hdd
```

### 5. Permanently mounting the HDD drive

Start by getting the UUID of the drive from the following command:

```
blkid /dev/vdX
```

Which will output something like the following:

```
/dev/vdb: UUID="c47903e9-90f1-459a-af41-eeabaa717659" TYPE="ext4"
```

Please copy everything that is inside the quotation marks after `UUID=`.&#x20;

Then you'll need to edit fstab:

```
vi /etc/fstab
```

{% hint style="warning" %}

#### Using `vi` (vim) Editor

* To get to edit mode, press `I` on your keyboard.
* To exit edit mode, press `Esc` on your keyboard.
* You can use arrow keys to navigate.
* To save changes, first make sure you're not in the edit mode and then, press `:` on your keyboard,  then type `w` and then press `Enter` .
* To exit the editor, press `:`  on your keyboard, then type `q`  and then press `Enter` .
  {% endhint %}

And within, on a new line at the bottom add the following:

```
UUID=your-uuid-here /hdd ext4 defaults 0 2
```

And your drive now will be permanently mounted.&#x20;
