Linux plus mount HDD

Source: Internet
Author: User

Connect the hard drive on the server, start Linux, and log in as root.

For example, if I add a new SCSI drive, I need to divide it into three zones:
Code:

#fdisk/dev/sdb
Enter Fdisk mode:
Command (M for help):p//View the partition of the new hard disk
Command (M for help): N//Create new partition

You can use the M command to see the internal command of the FDISK command; n command to create a new partition; d command to delete an existing partition; P command to display the partition list; t to modify the type ID number of the partition; l command to display the partition ID number column
A command specifies the boot partition, and the W command will save changes to the partition table to make it work.

Command Action
E Extended//Enter 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//First primary partition, you can divide up to 4 primary partitions according to your requirements
First Cylinder (1-1014,default 1): 1//number of disk blocks starting with the primary partition
Last Cylindet or +siza or +sizem or +sizek: +1024MB//Can be a number in megabytes or

Number of disk blocks, here we enter +1024MB to indicate a partition size of 1G.
F1

This creates a partition, and if you want to create more partitions, you can continue to create them as described in the previous steps.

Save the partition with W when you are finished creating it.
Code:

Command (M for help): W
The partition table has been altered!

Calling IOCTL () to re-read partition table.
Syncing disks.

So we're going to have to do a lattice village.
Code:

#mkfs-T Ext3-c/dev/sdb1//If there are multiple partitions, the partition is modified to SDB2 so
Mk
We need to mount the partition after the format is finished,
Code:

#mkdir www//Create/www directory, we will hook up the new partition to www
#mount/dev/sdb1/www//Mount/DEV/SDB1 to/www
# DF//view with df command
Filesystem 1k-blocks used Available use% mounted on
/dev/sda2 3771316 1388956 2190788 39%/
/DEV/SDA1 101089 9463 86407 10%/boot
None 62988 0 62988 0%/dev/shm
/DEV/SDB1 485906 8239 452580 2%/www//See, this is the newly mounted partition


By the end of this, if this is done, each time you restart the server after the manual mount, which is cumbersome, you need to modify the/etc/fstab file for automatic mount.
Code:

#vi/etc/fstab

At the end of the file, add the following:
Code:

/dev/sdb1/www ext3 Defaults 1 2

If you have more than one partition to modify SDB1 and/www, save after modifying and restart the server.

To the end of this work.

This article is from "Sir Pang's Test Nest" blog, please be sure to keep this source http://lrtest.blog.51cto.com/10869386/1711778

Linux Plus-mount hard disk

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.