Home > Article > Operation and Maintenance > How to mount a hard disk in centos?
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:
1. Check the currently unmounted hard disk
# fdisk -l
2. Create a hard disk partition
# fdisk /dev/sdb
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
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!