(Expansion system disk) how empty partition expansion of the system disk online expansion to the end of the root partition?

Operational scenario
after elastic cloud server to create a successful, if we find the system disk size capacity size of the system disk partition and the actual purchase of inconsistency can be expansion empty partition to a blank space root partition, expansion of the system disk.
This section describes how to empty partition online expansion to the end of the root partition.
Procedure
to CentOS 6.5 64bit 50GB system disk as an example, root partition most end of the partition expansion scene (eg: root / dev / xvda1 :: swap, / dev / xvda2).
Execute the following command, query the partition the current elastic cloud servers.
the parted -l / dev / xvda
[the root @ sluo-ECS-5e7d ~] # the parted -l / dev / xvda
the Model: the Xen the Virtual Block Device (XVD)
Disk / dev / xvda: 53.7GB
Sector size (Logical / PHYSICAL): 512B / 512B
Partition the Table: msdos

Number The the Start End Size the Type File System the Flags
. 1 1049kB 4296MB 4295MB Primary Linux-the swap (V1)
2 4296MB 42.9GB 38.7GB Primary ext4 Boot
execute the following command to get the file system type, UUID.
BLKID
/ dev / xvda1: the UUID = "25ec3bdb-ba24-4561-BCDC-802edf42b85f" the TYPE = "the swap"
/ dev / xvda2: the UUID = "1a1ce4de-e56a-4e1f-864d-31b7d9dfb547" the TYPE = "ext4"
execute command installation growpart tools.
Tools growpart may be integrated into cloud-utils-growpart / cloud- utils / cloud-initramfs-tools / cloud-init package, you can execute commands directly yum install cloud- * ensure growpart available commands can be.
yum install cloud-utils-growpart
execute the following commands using the tool growpart root partition of the second partition for expansion.
growpart / dev / xvda 2
[the root @ sluo-ECS-5e7d ~] # growpart / dev / xvda 2
CHANGED is: Partition = 2 Start = 8390656 Old: size = 75,495,424 End = 83.88608 million new new: size = 96,465,599,
If the expansion error execution partprobe # system re-read the partition table
kpartx / dev / xvda2 # allow the Linux kernel to read the partition table on a device, the corresponding partition of the device then generates behalf
execute the following command to check online expansion is successful.
the parted -l / dev / xvda
[the root @ sluo-ECS-5e7d ~] # the parted -l / dev / xvda
the Model: the Xen the Virtual Block Device (XVD)
Disk / dev / xvda: 53.7GB
Sector size (Logical / PHYSICAL): 512B / 512B
Partition the Table: msdos

Number The the Start End Size the Type File System the Flags
. 1 1049kB 4296MB 4295MB Primary Linux-the swap (V1)
2 4296MB 53.7GB 49.4GB Primary ext4 Boot
execute the command, expansion of the file system.
resize2fs -f $ partition names
assumed partition named / dev / xvda2, the command is as follows:
[the root @ sluo-ECS-A 611 ~] # resize2fs -f / dev / xvda2
resize2fs 1.42.9 (28-On Dec-, 2013)
the Filesystem AT / dev / xvda2 IS Mounted ON /; ON-Line Resizing required
old_desc_blocks =. 3, new_desc_blocks =. 3
....
[the root @ sluo-ECS-A 611 ~] # DF -ht // check file system expansion case

Guess you like

Origin www.cnblogs.com/puding/p/12171940.html