Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to mount data disk in linux system

Shulou Source: shulou.com Published: 2022-06-01 17:53:50 10月13日 Update

This article is about how to mount a data disk in a linux system. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Linux's CVM data disk is not partitioned and formatted. You can perform partitioning and formatting operations according to the following steps.

One: log in

Log in to the Ali CVM server using Linux's SSH login software (xshell or putty).

Second: view the host data disk

Before there is no partition and formatted data disk, using the "df-h" (enter) command, you cannot see the data disk, you can use the "fdisk-l" (enter) command to view it. As shown below:

Tip: if you execute the fdisk-l command and find that your cloud service data disk is not marked with / dev/xvdb, then you do not need to mount it. This tutorial is not applicable to you at this time.

Third, partition the data disk

Execute the "fdisk-S 56 / dev/xvdb" (enter) command to partition the data disk

According to the prompt, enter "n", "p"1", enter twice, and "wq"

N (enter)

P (enter)

1 (enter)

(enter)

(enter)

Wq (enter)

The partition will begin and will be completed soon.

Four: view the new partition.

Using the "fdisk-l" (enter) command, you can see that the new partition xvdb1 has been created.

Five: format the new partition

Use the "mkfs.ext3 / dev/xvdb1" command to format the new partition at different times depending on the size of the hard disk.

(you can also choose ext4 format on your own)

Six: set up the mount directory

Because this tutorial (install the linux server system environment from scratch), the editor uses the WDCP control panel, and its files are installed under the / www folder, so mount the www folder, but there is no www folder in the root directory, first create a command:

Cd. (enter) (return to the previous directory, to the root directory,.. There is a space in front)

Pwd (enter) (check whether the return is /, in the root directory)

Mkdir / www (enter) (create a www directory with a space before www in the root directory)

Seven: add partition information

Use the command "echo'/ dev/xvdb1 / www ext3 defaults 00'> > / etc/fstab" (enter) (included only) to write the new partition information.

Then use the "cat / etc/fstab" command to see that the following information indicates that the write was successful.

(the www is to mount the data disk to a folder separately. The default site data storage address for WDCP is www, so this is www. )

Eight: Mount the new partition

Use the "mount-a" command to mount the new partition, and then use the "df-h" command to view it. The following message indicates that the mount is successful and you can start using the new partition.

At this point, the hard disk has been loaded with OK, and the data disk can be used normally.

Thank you for reading! This is the end of the article on "how to mount a data disk in linux system". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Tags: Data commands formats files information folders root services systems servers directories login success hosts content tutorials more hard drives spaces articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi Huawei OPPO Reno Docker