Knowledgebase

How to mount a new hard disk in linux system Print

  • 217

1:View the unmounted disks on the server (disks include ordinary disks, high-efficiency disks, and SSD disks); the command is as follows:

fdisk -l

As you can see, in addition to the first vda hard disk, there is also a vdb.

2:Disk partition (partition includes primary partition, extended partition, logical partition); the command is as follows: Partition vdb, enter fdisk /dev/vdb, (see your own system hard disk name here, enter the hard disk name of your system), Operate in sequence, enter n - enter - enter p - enter - enter 1 - enter - enter - enter w

 

3:Format the disk and write to the filesystem: the command is as follows

mkfs.ext4 /dev/vdb1

Done appears at the end is OK.

 

4:To mount the new disk to a node of the operating system, the command is as follows:

mkdir /huichengff         \\Create a partition named huichengff, you can customize this name, such as /myhome

mount /dev/vdb1  /huichengff        \\Mount the hard disk to the partition

 

5:Check the disk information to confirm whether the new disk is successfully mounted. The command is as follows:

df

 

6:Set up automatic mount at startup;
The newly created partition cannot be automatically mounted at boot, and must be manually mounted every time the machine is restarted.To set the automatic mount at boot, you need to modify the /etc/fstab file; the command is as follows:

vi /etc/fstab

After opening, add the following code to the last line:

/dev/vdb1 /huichengff ext4 defaults 0 1          \\If ext3 is used above, ext3 is also used here;


Was this answer helpful?

« Back