Linux disk partition formatting

Source: Internet
Author: User
Tags disk usage

1. How do I view disk information?
2.vmware add hard drive how to identify?
3. How do I create a partition?

To view disk information:
Fdisk-l
The information for each disk and the partition information on the disk are displayed

650) this.width=650; "title=" image_thumb[1] "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image_thumb[1] "src=" http://img1.51cto.com/attachment/201408/30/8926377_ 1409415307tnii.png "" 358 "height=" 212 "/>
Df-h
The disk usage is displayed

650) this.width=650; "title=" image_thumb[4] "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image_thumb[4] "src=" http://img1.51cto.com/attachment/201408/30/8926377_ 1409415308lrj4.png "" 342 "height="/>

Add a hard drive in VMware

Add a disk on boot, and then use Fdisk-l to see that there is no automatic recognition and that a restart is required
Remove the hard drive while booting up, and then use Fdisk-l to view the following issues

650) this.width=650; "title=" image_thumb[6] "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image_thumb[6] "src=" http://img1.51cto.com/attachment/201408/30/8926377_ 14094153088ryl.png "" 348 "height="/>

partitioning and formatting of disks
You need to partition a new disk after you have added it, you can use the command fdisk (fixed disk)
FDISK [device]

650) this.width=650; "title=" image_thumb[11] "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image_thumb[11] "src=" http://img1.51cto.com/attachment/201408/30/8926377_ 1409415309wgwg.png "" 380 "height=" 319 "/>
Enter in interactive mode: M get help
To create a new partition:
Create Primary partition: M (m for help)-->n (add a new partition)-->p (primary partition (1-4))
Create extended partition: M (m for help)-->n (add a new partition)-->e (Extended)

Note: You can create up to four primary partitions and optionally create three primary partitions and one extended partition
It will look like this when it's created:
650) this.width=650; "title=" image_thumb[13] "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image_thumb[13] "src=" http://img1.51cto.com/attachment/201408/30/8926377_ 1409415311intc.png "" 394 "height=" 183 "/>

You need to format the partition after creating the partition, that is, to create the file system, using the command mkfs (make file)
MKFS options:
-t:fstype file system type, for example: Mkfs-t Ext4 is also equivalent to MKFS.EXT4
Mkfs.ext4/dev/sdc1
Mkfs.ext4/dev/sdc2
Mkfs.ext4/dev/sdc3

Mount Partition
Temporary mount:
Create three directories
Mkdir-p/mydata/data{1,2,3}
then mount them separately.
Mount-t ext4/dev/sdc1/mydata/data1
Mount-t Ext4/dev/sdc2/mydata/data2
Mount-t ext4/dev/sdc3/mydata/data3
To view mount conditions:

650) this.width=650; "title=" image_thumb[15] "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image_thumb[15] "src=" http://img1.51cto.com/attachment/201408/30/8926377_ 1409415313ursi.png "" 394 "height=" 197 "/>

Automatic mount on Boot:
Need to edit the/etc/fstab file to write mount information to
650) this.width=650; "title=" image_thumb[17] "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image_thumb[17] "src=" http://img1.51cto.com/attachment/201408/30/8926377_ 1409415314b4xl.png "" 394 "height=" 217 "/>
Description
The contents of the file are divided into six parts with blank characters:
1. Mounted Devices
Device file, volume label, UUID
2. Mount point
3. File system type
4. Mount selection, defaults means use default option, multiple options comma delimited
5. Dump frequency: How long does the dump take to make a backup
0: Never Back up
1: Daily backup
2: Backup every other day
6. Self-Test order:
Self-test, check whether the file is complete, remove the incomplete files
0: No detection
1: The first detection, usually the root file system





Linux disk partition formatting

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.