Step 4: Attach the disk

1. Query the device number of the newly disk

As shown in the figure below, in this example, the new disk device number is /dev/sdb, and the size is 10G; the disk has automatically completed the settings of the partition (/dev/sdb1) and file system (ext4), and you can attach it directly.

2. Attach the file system in the disk

Here are two attaching methods: Manual Attaching and Automatic Attaching.
● Manual Mounting: After each restart, you need to manually attach the partition to the response directory again
● Automatic Attaching: The system is automatically completed when the system is restarted. You do not need to manually attach these disks again.

If we want to attach the new disk to the /data directory, we need to manually create the directory and then start attaching.

a. Manual Attaching
Use the attach command to attach the partition /dev/sdb1 to the /data directory, and then use the df -h command to inquiry the attached partitions and find that /dev/sdb1 has indeed been successfully attached.


b. Automatic Attaching
Use the blkid name to query the UUID and partition format of the unattached partition, and record the relevant information.

Open the /etc/fstab file and add a line of attach information: the first column is the uuid of the partition, the second column is the directory to be mounted, the third column is the partition format (ext4), and the last three columns keep the default default 0 0. After modifying /etc/fstab, press :wq to save and exit.

Then use the command mount -a to automatically attach the partition, and use





The attached partition written in the /etc/fstab file will be automatically read and attached when the system restarts.
After the attach is complete (manually or automatically), we can save the data to the newly added sdb disk through the /data directory.

3. Detach the disk

If the disk is no longer used, you can manually unattach the disk in the system.

a. Manually attached disk:
First make sure that the disk-attached directory is not being read or written, and the current directory is not a attached directory.
Then execute the command umount /dev/sdb1

b. Automatically mounted disks:
First make sure that the disk-attached directory is not being read or written, and the current directory is not a attached directory.

Then execute the command umount /dev/sdb1

Finally, delete the corresponding attach line in the /etc/fstab file, save and exit.
(Note: This step must be executed, otherwise there will be problems at startup after the system restarts)