Use fdisk to add a new hard disk under RedHat

Source: Internet
Author: User
In RedHat, use fdisk to add the new hard disk-Linux Enterprise Application-Linux server application information. For details, refer to the following section. The following describes how to add a new scsi hard disk to an original scsi hard disk.
Connect the hard disk to the server, start redhat, and log on as root.
1. Confirm to recognize the new hard disk and execute the following command:
# Dmesg | grep sd
If the device name sdb in the Command result indicates that the new hard disk has been correctly recognized by the operating system
(Note: scsi hard disk device name in linux
SCSI's 1st hard disks/dev/sda, and 2nd hard disks/dev/sdb)

2. Use the fdisk command to partition the new hard disk.
# Fdisk/dev/sdb
Enter the fdisk mode:
Command (m for help): m // view the help of the fdisk Command
Command Introduction: n command to create a new partition; d command to delete an existing partition; p command to display the partition list; t command to modify the partition type; l command to display the list of partition types; command a specifies to start the partition. Command w indicates to modify the disk for the partition table.

Command (m for help): n // create a new partition

Command action
E extended // input e to create an extended partition
P primary partition (1-4) // input p to create the primary partition. Here we select p

Partion number (1-4): 1 // The first extended partition, which can be divided into up to four primary partitions as needed
First Cylinder (1-1014, default 1): 1 // Number of disks starting from the First primary partition. You can select the default value.
Last cylindet or + siza or + sizeM or + sizeK: + 1024 MB // It Can Be A number in MB or the number of disk blocks, in this example, we enter + 1024MB to indicate that the partition size is 1 GB.
In this way, we have created a partition. If you want to create more partitions, you can continue to create the partition according to the above steps. After all the partitions are created, use w to save the partitions.
Command (m for help): w
The partition table has been altered!

Restart the server after saving the file. You can use
# Run the fdisk-l command to check the created partition. You can confirm the/dev/sdb1 information in the returned result.

3. format the partition
Use the following command to format the new partition to ext3
# Mkfs-t ext3-c/dev/sdb1

4. Mount partitions
After formatting, we need to mount the partition.
# Mkdir/test
# Mount/dev/sdb1/test
# Df // use the df command to view
Filesystem 1K-blocks Used Available Use % Mounted on
/Dev/sda1 101089 9463 86407 10%/boot
None 62988 0 62988 0%/dev/shm
/Dev/sdb1 485906 8239 452580 2%/test // newly mounted Partition

To automatically mount a new partition when the system starts, you need to modify the/etc/fstab file for automatic mounting. Add the following line to the last position of the file:
/Dev/sdb1/test ext3 defaults 1 2

In this way, the partition is automatically attached to the server every time it is started, and the process of adding a new hard disk ends.
Related Article

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: info-contact@alibabacloud.com 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.