Linux mount New Hard Drive method (GO)

Source: Internet
Author: User

1. Turn off the server plus the new hard drive

2. Start the server and log in as root

3. View hard Drive information

#fdisk-L

[CPP]View PlainCopy
  1. disk/dev/sda:42.9 GB, 42949672960 bytes
  2. 255 heads, Sectors/track, 5221 cylinders
  3. Units = Cylinders of 16065 * 8225280 bytes
  4. Sector size (logical/physical): bytes/512 bytes
  5. I/O size (minimum/optimal): bytes/512 bytes
  6. Disk identifier:0x0004406e
  7. Device Boot Start End Blocks Id System
  8. /DEV/SDA1 * 1 307200 Linux
  9. Partition 1 does not end on cylinder boundary.
  10. /dev/sda2 2589 20480000 Linux
  11. /dev/sda3 2589 2850 2097152, Linux Swap/solaris
  12. /DEV/SDA4 2850 5222 19057664 5 Extended
  13. /dev/sda5 2850 5222 19056640-up Linux
  14. disk/dev/sdb:10.7 GB, 10737418240 bytes
  15. 255 heads, Sectors/track, 1305 cylinders
  16. Units = Cylinders of 16065 * 8225280 bytes
  17. Sector size (logical/physical): bytes/512 bytes
  18. I/O size (minimum/optimal): bytes/512 bytes
  19. Disk identifier:0x14b52796
  20. Device Boot Start End Blocks Id System

4. Create a new hard disk partition command parameter:

Fdisk can use the M command to see the internal commands of the FDISK command;

A: The command specifies the boot partition;

D: command to delete an existing partition;

L: command displays a list of partition ID numbers;

M: View the fdisk command help;

N: command to create a new partition;

P: command displays a list of partitions;

T: Command modifies the type ID number of the partition;

W: The command is to save changes to the partition table to make it work.

5. Enter the disk, partition the disk, and note the Red section.

#fdisk/dev/sdb

[CPP]View PlainCopy
  1. Command (M for help ): N
  2. Command Action
  3. E Extended //Enter E to create an extended partition
  4. P primary partition (1-4) //input p to create a logical partition
  5. P
  6. Partion Number (1-4): 1 //Enter the L here and enter the logical partitioning phase;
  7. First Cylinder (51-125, Default): //Note: This is the start value of the partition, it is best to press ENTER directly, if you enter a non-default number, will cause space waste;
  8. Using Default Value Wuyi
  9. Last cylinder or +size or +sizem or +sizek (51-125, default): +200m Note: This is the definition of the partition size, +200m is the size of 200M, of course, you can also according to the P hint of the unit CY The size of the Linder is counted, and then the value of end is specified. Look back to see how it is, or use +200m this method to add, this can be intuitive. If you want to add a 10G or so size partition, please enter +10000m;
  10. Command (M for help ): W //Last input W enter save.

Take a look:

#fdisk-L

You can see the/DEV/SDB1 partition, I'll omit it.

6. Format the partition:

#mkfs. EXT3/DEV/SDB1//NOTE: Format/dev/sdb1 as ext3 type

[CPP]View PlainCopy
  1. MKE2FS 1.41.12 (17-may-2010)
  2. File System label =
  3. Operating system: Linux
  4. Block size =4096 (log=2)
  5. Chunked size =4096 (log=2)
  6. Stride=0 blocks, Stripe width=0 blocks
  7. 640848 inodes, 2562359 blocks
  8. 128117 blocks (5.00%) reserved for the super user
  9. First block of data =0
  10. Maximum filesystem blocks=2625634304
  11. Block groups
  12. 32768 blocks per group, 32768 fragments per group
  13. 8112 inodes per group
  14. Superblock backups stored on blocks:
  15. 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
  16. Writing Inode table: complete
  17. Creating Journal (32768 blocks): complete
  18. Writing Superblocks and FileSystem accounting information: Complete
  19. This filesystem would be automatically checked every mounts or
  20. Whichever comes first. Use Tune2fs-c or-i to override.

So it's formatted so that we can load the partition with mount and then use the filesystem;

7. Create the/DATA1 directory:

#mkdir/data1

8. Start Mount Partition:

#mount/dev/sdb1/data1

9. View the hard disk size and mount the partition:

#df-H

10. Configure Boot Auto Mount

Because mount Mount fails after restarting the server, it is necessary to write the partition information to the/etc/fstab file so that it is permanently mounted:

#vim/etc/fstab

Join:

/DEV/SDB1 (disk partition)/data1 (Mount directory) ext3 (file format) defaults 0 0


11. Rebooting the system

Linux mount New Hard Drive method (GO)

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.