CentOS mount New Hard Drive automatic mounting

Source: Internet
Author: User

CentOS mount New Hard Drive automatic mounting
Linux hard disk 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 = cylindersof16065 * 512 = 8225280 bytes

DeviceBootStartEndBlocksIdSystem
/Dev/sda1*11310439183 Linux
/Dev/sda214213240957717 + 83 Linux
/Dev/sda3511352431052257 + 82 Linuxswap/

Solaris
/Dev/sda45243167691006150955extended
/Dev/sda5524316769100615063 + 83 Linux

Disk/dev/sdb: 291.3 GB, 291331192320 bytes
255 heads, 63 sectors/track, 17769 cylinders
Units = cylindersof16065 * 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 (mforhelp): n
Commandaction
Eextended // input e to create an extended partition
Pprimarypartition (1-4)
P
Partionnumber (1-4): 1

Command (mforhelp): 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/dataext3defaults12
View cat/etc/fstab
The following is a reference clip:

LABEL = // ext3defaults11
LABEL =/data/dataext3defaults12
LABEL =/boot/bootext3defaults12
Tmpfs/dev/shmtmpfsdefaults00
Devpts/dev/ptsdevptsgid = 5, mode = 62000
Sysfs/syssysfsdefaults00
Proc/procprocdefaults00
LABEL = SWAP-hda3swapswapdefaults00
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.