Add new hard disks, partitions, formatting, and automatic mounting to Centos

Source: Internet
Author: User

Step 1: Create the partition root # fdisk/dev/had à and go to the newly added hard disk.The number of cylinders for this disk is set to 10402. there is nothing wrong with that, but this is larger than 1024, and cocould in certain setups cause problems with: 1) software that runs at boot time (e.g ., old versions of LILO) 2) booting and partitioning software from other OSs (e.g ., dos fdisk, OS/2 FDISK) Command (m for help): nà create a new partition Command actioneextendedpprimary Partition (1-4) pà create a primary partition Partition number (1-4): 1à new primary partition No. First cylinder (1-10402, default 1): Using default value 1 Last cylinder or + size or + sizeM or + sizeK (1-10402, default 10402): + 500mà create primary partition SIZE Command (m for help): wà Save the created primary PartitionStep 2: make the new partition take effect immediately in the systemRoot # partprobeStep 3: format the newly created Partition[Root @ server ~] # Mkfs. ext3/dev/hda1mke2fs 1.39 (29-May-2006) Filesystem label = OS type: LinuxBlock size = 1024 (log = 0) Fragment size = 1024 (log = 0) 122400 inodes, 488848 blocks24442 blocks (5.00%) reserved for the super userFirst data block = 1 Maximum filesystem blocks = 6763315260 block groups8192 blocks per group, 8192 fragments per group2040 inodes per groupSuperblock backups stored on blocks: 8193,245 77, 40961,573 45, 73 729,204 801, 221185,401 8192 Writing inode tables: doneCreating journal (blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 27 mounts or180 days, whichever comes first. use tune2fs-c or-I to override. [root @ server ~] #Step 4: mount the newly created partition to the/mnt/rhce01 directoryRoot # mount/dev/hda1/mnt/rhce01Step 5: Make the mounting still valid after system restartRoot # vim/etc/fstabà edit this file and add the upper and lower lines to make the mounting effective after restart; LABEL =/1/ext3defaults1 1 tmpfs/dev/shmtmpfsdefaults0 0 devpts/dev/ptsdevptsgid = 5, mode = 6200 0 sysfs/syssysfsdefaults0 proc/procprocdefaults0 LABEL = SWAP-sda3swapswapdefaults0 0/dev/hda1/mnt/rhce01ext3defaults0In addition, before adding a hard disk to a host, you must first understand the hard disk and partition naming method in Linux. In Linux, the SCSI device is named sd, the first scsi device is sda, and the second is sdb. Generally, there are two SCSI interfaces on the motherboard, and four SCSI devices can be installed in total. The two devices on the primary SCSI correspond to sda and sdb respectively, and the two devices on the second SCSI port correspond to sdc and sdd respectively. Generally, the hard disk is installed on the primary interface of the primary SCSI, so it is sda or sdb. The optical drive is usually installed on the primary interface of the second SCSI, so it is sdc. (The IDE interface device is named after hd. the first device is hda, and the second is hdb. So far.) The partition is named by the device name and 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. For every multiple partitions, you can add 1 to the number. 1. Partition the hard disk with fdisk/dev/sda.
Command (m for help): n
Command action
E extended
P primary partition (1-4)
Input: e
Partition number (1-4): 1
First cylinder (1-9729, default 1): Press ENTER
Last cylinder or + size or + sizeM or + sizeK (1-9729, default 9729): Press ENTER
Command (m for help): w (save and exit) 2. format the hard disk fdisk-l
Mkfs-t ext3/dev/sda1
Writing superblocks and filesystem accounting information: Press enter. 3. Mount
Mount/dev/sda1/test4, mount directly at startup
Edit the/etc/fstab file
Add:/dev/sda1/test ext3 defaults 1 1 restart, and then select the one already mounted.

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.