Linux Basics (17)-using GPT partitioning, extending the swap partition--rhel6.5

Source: Internet
Author: User
Tags uuid uuid identifier

1. Volume label boot automatic disk

Disk replacement After server disk corruption, replacement of the disk may cause confusion in the disk location, resulting in data confusion, so you need to label the disk, to prevent disk confusion, used here: E2label

To add a label to a specified partition:

E2LABEL/DEV/SDB1 Label1

To view the newly added tags:

E2label/dev/sdb1

Modify Boot Auto Mount:

Change the original device name/DEV/SDB1 to Label=lable1 and the rest without modification.

2. UUID identifier partition

Because labels do not have an error even if the system is duplicated, it is also a hidden hazard to use label tables, since this is the recommended use of UUID to identify partitions.

The UUID is a string of memory devices in the system to help the user uniquely determine the storage device in the system, so the UUID is the only one in the world, not only to identify disks, but also to recognize storage devices such as DVD drives and USB. Because the UUID is the only one in the world, it is highly secure.

Gets the UUID of the partition can use Blkid also can use TUNE2FS.

Blkid Get partition UUID:

Blkid | grep sdb1

TUNE2FS Get UUID:

Tune2fs-l/DEV/SDB1 | grep UUID

After detecting the partition's UUID, modify the Auto Mount Profile:/etc/fstab, change the device to: Uuid= ID detected.

3. Special Circumstances

You are prompted to use this partition when you unmount the partition, and you cannot uninstall it:

At this point, it is possible that a program is using the partition, at which point you can use LSOF/DEV/SDB1 to see if those processes are using the partition, notifying the consumer to kill the process and then uninstalling.

4. Using GPT Partitioning

GPT is a globally unique partitioned table that has no limit on the number of GPT partitions, compared to the maximum of 4 partition table entries (primary and extended partitions) of the MBR. Windows supports a maximum of 128 GPT partitions,

GPT manageable hard disk size up to 18EB,NTFS format supports up to 256T, but 2T has expanded a lot compared to MBR mode.

GPT partitioning requires tools parted

To view disk partition information:

Parted-l #比fdisk-L information found in more detail

(1) Create a new partition for/DEV/SDB:

Parted/dev/sdb

P #查看磁盘分区状态

Mklabel #新建标签

GPT #标签类型为gpt

Mkpart #新建分区

Mydisk1 #设置新建的分区的名称

The file system of a partition can be specified by default and subsequently formatted.

1 #第一个分区的起始点一定是1

100M #第一个分区大小设置为100M, the second partition has a starting point of 100M

P #查看新建的分区状况

Quit new partition complete, exit

(2) formatting

This is formatted as a EXT4 file system:

Mkfs.ext4/dev/sdb1

(3) Mount new partition

New mount point:

Mkdir/sdb1

Mount:

Mount/dev/sdb1/sdb1

(4) Automatic mount on Boot

To query the UUID of the new partition:

Tune2fs-l/DEV/SDB1 | grep UUID

Automatic mount information write to the/etc/fstab file, referring to the previous blog post

(5) test

Whether the test can be mounted automatically:

Mount-a

To see if the mount is mounted:

Df-h

5. Extended Swap partition

Create a new normal partition according to the above 4/SDB2

To create a new swap partition:

Mkswap/dev/sdb2

To start a swap partition:

Swapon/dev/sdb2

Check that the swap partition is enlarged:

Free-m

Swap Auto Mount:

/etc/fstab Add:

/DEV/SDB2 swap swap defaults 0 0

Whether the test can be mounted automatically:

Mount-a #此时df-H discovery is not automatically mounted, so the swap partition needs to be restarted to take effect, which is used by the kernel.

To unmount a swap partition:

Swapoff/dev/sdb2

Check whether it is uninstalled:

Free-m

Linux Basics (17)-using GPT partitioning, extending the swap partition--rhel6.5

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.