Key Points of adding a new hard disk and partitioning and formatting in Linux

Source: Internet
Author: User

Key Points of adding a new hard disk and partitioning and formatting in Linux


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:


You can also use cfdisk for partitioning. The command is as follows:


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-

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.