Using Fdisk under Linux to expand the partitioning capacity tutorial

Source: Internet
Author: User
Description

Operating system: CentOS

Disk capacity of 300GB, before the partition of only a 150GB/data partition, now/data partition is not enough.

Requirements: Increase the remaining 150GB capacity of this disk to the previous/data partition, and ensure that the original data of the/data partition is not corrupted.

Specific actions:

First, shut down the service that uses/data partition, here/data partition is MySQL database

Service Mysqld Stop

Second, remove the disk, repartition

1, uninstall the disk

Umount/data

If you are prompted to be busy, use Fuser to find the program that is using the disk and end it.

Fuser-k/data

2, disk partition

Resize a disk partition using the FDISK command

Fdisk-l

Fdisk/dev/sdb

P #查看磁柱号, remember, use the following

D #删除之前的分区

N #建立新分区

P #主分区

1 #第一个主分区

Delete the previous partition, then create a new partition, note that the beginning of the magnetic column to be consistent with the original (to ensure that the data do not lose the key steps), the end of the magnetic column default return to use all the disk.

Wq #保存分区信息并退出

3, adjust the partition

E2fsck-f/DEV/SDB1 #检查分区信息

RESIZE2FS/DEV/SDB1 #调整分区大小

4. Re-mount the partition

Mount/data

Df-h #可以看到磁盘容量已经变为300GB了

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.