Information Center

Linux Centos Hard Disk Mounting Tutorial

  

1.  Fdisk - l//Query the name of the unmounted hard disk, such as sdb1,
 
input
Command: fdisk /dev/sdb   Take the newly attached data disk "/dev/sdb" as an example

  1. Input“ n ”, press Enter to start creating a new partition.

  2. Input“ p ”, press Enter to start creating a primary partition.

  3. Enter the primary partition number“ one ”, press Enter.

  4. Press Enter.

  5. Press Enter.

  6. Input“ p ”, press Enter to view the details of the new partition.

  7. Input“ w ”, press "Enter" to write the partition result to the partition table.

two . input Command: mkfs.ext4 /dev/sdb1   format partition

three input Command: mkdir /www   Create a directory named www

four input Command: mount /dev/sdb1 /www   Attach the sdb hard disk as/www

five input Command: echo "/dev/sdb1 /www ext4 defaults 0 0" >> /etc/fstab

six input Command: cat /etc/fstab

Mount completed:

Df - h input displays the mounting condition of the hard disk

1. Operation on Linux backup data 1. First connect to the server with XSHELL and then wait for the connection

2. Enter cd/www/web/xingxilou_net/public_html2 to package the directory public_html2

3. Then execute tar zcvf a1.tar.gz/www/web/xingxilou_net/public_html to compress the directory public_html2 into gz format

4. The a1.tar.gz name needs to be changed every time it is backed up, such as 1.tar.gz
5. After the command is executed, use your website domain name and the name of the backup compressed package directly!

 

 

First, remote SSH logs in to the CentOS server and performs the following operations. Friendly prompt: The data will be cleared during the mount operation. Please make sure that the mount disk has no data or is not used before the operation.

1. Enter the command: ll /dev/disk/by-path   List all disks

Tip: If you cannot confirm the device name of the data disk, use the df command to confirm the name of the system disk, so as to exclude the wrong disk.

2. Command: fdisk /dev/sdb   Format hard disk

Note: Continue to type manually at the arrow mark in the figure

3. Command: mkfs.ext4 /dev/sdb1   Create partition

 

4. Command: mkdir /www   Mount the partition (the directory name is optional)

five Command: mount /dev/sdb1 /www   Attach the sdb hard disk as/www

six Command: df -h   Display hard disk usage

Write the information into the fstab to enable the system to automatically mount.

7. Command: echo "/dev/sdb1 /www ext4 defaults 0 0" >> /etc/fstab

8. Command: cat /etc/fstab