Key Points of adding a new hard disk and partitioning and formatting in Linux
Prerequisites
Before adding a hard disk to a host, you must first understand the hard disk and partition naming method in Linux.
In Linux, IDE devices are named after HD. The first ide device is hda, and the second is HDB. And so on
Generally, there are two ide interfaces on the motherboard. you can install four ide devices in total. The two devices on the primary ide correspond to hda and HDB respectively, and the two devices on the second ide port correspond to HDC and HDD respectively.
Generally, the hard disk is installed on the main interface of the primary IDE, so it is hda
The optical drive is usually installed on the master interface of the second IDE, so it is HDC (HDB should be used to name the slave interface on the main IDE)
The SCSI interface device is named after SD. the first device is SDA, and the second is SDB. And so on
A partition is named by a device name and a number. For example, hda1 represents the first partition on the hda hard disk device.
Each hard disk can have a maximum of four primary partitions. The role is to name the primary partition of the hard disk from 1 to 4. Logical partitions start from 5. Each time you have multiple partitions, you can use numbers.
For example, a general system has a primary partition used to guide the system. This partition is named hda1. Next we will divide the three logical partitions into D, E, and F, which are commonly referred to as hda5, hda6, and hda7 in Linux.
Partitioning a hard disk
Slackware has two partitioning software: fdisk and cfdisk.
For example, if you already have a hard disk, add another hard disk to the system.
According to the naming rules, the newly added hard disk should be HDB. Run the following command to partition a hard disk:
Fdisk/dev/HDB
You can also use cfdisk for partitioning. The command is as follows:
Cfdisk/dev/HDB
Format hard disk
Format to ext3 format
Mkfs. ext3/dev/hdb1
Format to reiserfs
Mkfs. reiserfs/dev/hdb1
Enable automatic mounting of Hard Disks
For example, Mount/dev/hdb1 to the/mnt/HD directory.
Use VI to edit the/etc/fstab file and add the following content:
/Dev/dhb1/mnt/HD reiserfs defaults 1 1
Make the attached hard disk effective: Mount-