CentOS mount new hard drive automatic mounting

Source: Internet
Author: User
Linux hard disk recognition: sda indicates 1st SCSI hard disks. hda indicates 1st IDE hard disks. content 0 indicates that 1st USB optical drives are generally used & ldquo; fdisk Linux hard disks. recognition:
Sda indicates 1st SCSI hard disks
Hda indicates 1st IDE hard disks
1st USB optical drives
You can use the "fdisk-l" command to list the hard disks currently connected to the system.

Steps:
1. disable the server and add a new hard disk.
2. start the server and log on as the root user.
3. View hard disk information

The following is a reference clip:
Fdisk-l

Appears:
 
The following is a reference clip:
Disk/dev/sda: 146.1 GB, 146163105792 bytes
255 heads, 63 sectors/track, 17769 cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System
/Dev/sda1*1 13 104391 83 Linux
/Dev/sda2 14 5112 40957717 + 83 Linux
/Dev/sda3 5113 5243 1052257 + 82 Linux swap/

Solaris
/Dev/sda4 5244 17769 100615095 5 Extended
/Dev/sda5 5244 17769 100615063 + 83 Linux

Disk/dev/sdb: 291.3 GB, 291331192320 bytes
255 heads, 63 sectors/track, 17769 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Disk/dev/sdb1: 291.3 GB, 291331192320 bytes

4. create a new hard disk partition
 
The following is a reference clip:
Fdisk can use the m command to view the internal command of the fdisk command;
A: The command specifies the start partition;
D: command to delete an existing partition;
L: The Command displays the list of partition ID numbers;
M: view the fdisk command help;
N: create a new partition;
P: command to display the partition list;
T: command to modify the ID number of the partition type;
W: The command is used to modify and save the partition table.

The following is a reference clip:
Fdisk/dev/sdb

 
The following is a reference clip:
Command (m for help): n
Command action
E extended // input e to create an extended partition
P primary partition (1-4)
P
Partion number (1-4): 1

Command (m for help): w

Enter n to press enter, then p to press enter, then 1 to press enter, all the way to press enter, and finally enter w to press enter to save.
View: fdisk-l
The/dev/sdb1 partition is displayed.

5. format the partition:

The following is a reference clip:
Mkfs. ext3/dev/sdb1


6. create/data Directory:

The following is a reference clip:
Mkdir/data


7. mount the partition:

The following is a reference clip:
Mount/dev/sdb1/data


8. configure automatic mounting upon startup because mount fails after the server is restarted, you need to write the partition information to the/etc/fstab file for permanent mounting:

The following is a reference clip:
Vi/etc/fstab

Join:
 
The following is a reference clip:
LABEL =/data ext3 defaults 1 2

View cat/etc/fstab
The following is a reference clip:

LABEL = // ext3 defaults 1 1
LABEL =/data ext3 defaults 1 2
LABEL =/boot ext3 defaults 1 2
Tmpfs/dev/shm tmpfs defaults 0 0
Devpts/dev/pts devpts gid = 5, mode = 620 0 0
Sysfs/sys sysfs defaults 0 0
Proc/proc defaults 0 0
LABEL = SWAP-hda3 swap defaults 0 0

9. restart the system

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.