Linux hard disk partition, partition, delete partition, format, mount, uninstall

Source: Internet
Author: User

1. Create a partition

Check to see if there are no partitions on the disk

Fdisk-l  

The first box and the second box are the different disks that have been divided into a good area.

Start partition

#输入要进行分区的磁盘名称
Fdisk/dev/sdb

Enter m to see what actions are available

Enter P to view the current hard disk partition, which currently has a partition.

Enter N to create a new partition, enter p to create a partition, enter partition number 2 to create a second partition

Then let you set the start sector, directly to the enter to represent the non-input directly from the vacant Disk Start Section Start division

Then end the sector settings custom partition It 300G, can be divided according to their own needs. Note that the "+" setting must be in front of 300G to be valid.

If you want to continue to create a third partition, continue to enter N,p, and then define the partition size

Last Save partition Input W

Finally, check to see if the partition has been established! If a red area appears, it is already established.

In fact, this time, the establishment of a good partition can not be used, but also need to mount to use. But before it is mounted, it must be formatted before it can be done.

2. Formatting partitions

1) fdisk-l |grep SD View partition status

or fdisk-l.

2) Create data store directory, store path customization

Mkdir-p/openstack/glance

Mkdir-p/openstack/mysql

Mkdir-p/openstack/data

......

3) format the disk that you just partitioned

MKFS.XFS/DEV/SDB1 Formatting SDB1 disks

MKFS.XFS/DEV/SDB2 Formatting SDB2 disks

Mkfs.xfs/dev/sdb3

......

4) Vim/etc/fstab

/DEV/SDB1/OPENSTACK/GLANCE/XFS Defaults 0 0
/DEV/SDB2/OPENSTACK/MYSQL/XFS Defaults 0 0
/DEV/SDB3/OPENSTACK/DATA/XFS Defaults 0 0

/etc/ Fstab file is responsible for configuring the Linux boot automatically mount partition

The first column can be the actual partition name or the actual partition's volume label (lable)

The second column is the mount point, The mount point must be a directory that currently exists

The third column is the file system type for this partition

auto:  system automatically mounts, fstab default is this option
Defaul TS: RW, suid, Dev, exec, auto, Nouser, and async.
noauto  Boot does not mount automatically
nouser  only Superuser can mount
ro  mount with read-only permission
rw  mount by read-write permission
user  Any user can mount the
Note that the optical drive and floppy drive can be mounted only when the media is installed, so it is Noauto

 

The fifth column is the dump backup setting, when its value is set to 1 o'clock, the dump backup program is allowed to be backed up, set to 0 o'clock, the backup operation is ignored,

5) mount-a for disk mount

6) df-a View mount status

3. Solution Hanging

1) fdisk-l |grep SD View partition status

or fdisk-l.

2) Umount/dev/sdb3 lifting the Mount Sdb3 as an example

The solution hangs, actually can also mount, and the data will also be in the

4. Deleting a partition
Fdisk/dev/sdb  m  d  3  W

Input W save, this time partition and deleted, can be recreated.

Linux hard disk partition, partition, delete partition, format, mount, uninstall

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.