Home>Article>Operation and Maintenance> How to mount a hard disk in centos?

How to mount a hard disk in centos?

coldplay.xixi
coldplay.xixi Original
2020-07-28 13:46:36 11457browse

How to mount a hard disk in centos: first check the currently unmounted hard disk and create a hard disk partition; then format the hard disk and create a mounting directory; then mount the hard disk and set it to be automatically mounted at boot; Finally, restart the server.

How to mount a hard disk in centos?

How to mount a hard disk in centos:

1. Check the currently unmounted hard disk

# fdisk -l

How to mount a hard disk in centos?

2. Create a hard disk partition

# fdisk /dev/sdb

How to mount a hard disk in centos?

According to the prompts, enter "n", "p" and "1" in sequence. Enter "wq" the next time, and the partitioning will begin and will be completed soon.

3. Format the hard disk

# mkfs.ext4 /dev/sdb

How to mount a hard disk in centos?

4. Create a mounting directory

# mkdir /data

5. Mount the hard disk

# mount /dev/sdb /data

6. Set up automatic mounting at boot

# vi /etc/fstab

Enter i in vi to enter INERT mode, move the cursor to the end of the file and press Enter, copy/paste the following content, then press the Esc key and enter ":wq" (without double quotes) save and exit

/dev/sdb /data ext4 defaults 0 0

7. Restart the server

# shutdown -r now

Recommended related tutorials:centos tutorial

The above is the detailed content of How to mount a hard disk in centos?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to install centos tools Next article:How to install centos tools