Вы находитесь на странице: 1из 2

Ref:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/storage_expand_partition.html
Ref: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-
volume.html#recognize-expanded-volume-linux
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1. Mount your copy of your root volume to another server & follow below step.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[root@]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 30G 1.2G 29G 4% /
devtmpfs 2.0G 64K 2.0G 1% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm

[root@]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 30G 0 disk
+-xvda1 202:1 0 30G 0 part /
xvdf 202:80 0 200G 0 disk ;--> this the root volume that we want to
expand
+-xvdf1 202:81 0 8G 0 part ;--> make sure the volume is unmount

[root@]# parted /dev/xvdf


GNU Parted 2.1
Using /dev/xvdf
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit s

(parted) print
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdf: 419430400s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags


1 2048s 16777215s 16775168s primary ext4 boot

(parted) rm 1
(parted) mkpart primary 2048s 100%

(parted) print
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdf: 419430400s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags


1 2048s 419430399s 419428352s primary ext4

(parted) set 1 boot on

(parted) quit
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2. Then, attach back to your current server that need the root directory;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[root@]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.9G 4.4G 3.2G 59% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
[root@]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 200G 0 disk
+-xvda1 202:1 0 200G 0 part /

#resize2fs /dev/xvda1
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 13
Performing an on-line resize of /dev/xvda1 to 52428544 (4k) blocks.
The filesystem on /dev/xvda1 is now 52428544 blocks long.

[root@]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 197G 4.5G 183G 3% /
tmpfs 7.8G 0 7.8G 0% /dev/shm

Вам также может понравиться