Linux partition extension (preserves data)

Source: Internet
Author: User
Tags extend

Environment Introduction:

System: CentOS 6.9

Scenario Description:

When installing the system, no logical volume is used to create the partition, which causes the partition to be full and cannot be expanded online;
(1) The current disk size 100g,50g create partition/dev/sda1, Mount/data, the remaining 50GB is unused;
(2) When the/data/data is full, the remaining 50GB is extended to/dev/sda1 to achieve the purpose of expansion;
Note: Non-logical volume expansion requires a umount mounted directory
Note: If the virtual machine has no remaining space, you can extend the partition further by extending the virtual disk

(3) To avoid data loss, record the start of the magnetic column number of the extended partition
Shell> fdisk-l

(4) Unmount partition
1, the operation of the partition to stop reading and writing
2, Shell> Umount/data
3, if prompted busy, use Fuser to find the kill process
Shell>fuser-m-v/data
Shell>fuser-m-v-i-k/data

(5) Shell>fdisk/dev/sda re-partitioning the SDA1

P Remember the number of the extended magnetic column (be sure to remember)
D Delete the partition you want to extend (remember the partition number)
n Create a new partition
P Use primary partition
1 using the deleted partition number
First Cylinder: (Remember the beginning of the magnetic column, must not be wrong)
Last cylinder: Custom, if enter default all space
Wq

(6) Check whether the partition is recognized, the magnetic column number is changed
Shell>fdisk-l

(7) Adjust the partition
Shell>e2fsck-f/DEV/SDA1 Check partition information
SHELL>RESIZE2FS/DEV/SDA1 Resizing a partition

(8) Re-mount
Shell> mount-a
Shell> Df-h to see if the partition has changed

Linux partition extension (preserves data)

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.