resize2fs를 이용한 파티션 리사이징

가상화를 쓰다보면.. 처음부터 디스크 용량을 크게 잡기도 부답스럽고 해서 적게 잡는다.

운영하다보면.. 필연적으로 용량을 늘려줘야 하는 경우가 생김.. 이럴 경우 사이즈 resize2fs를 통해서 리사이징 할수 있음

[ ~]# fdisk /dev/xvdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): p

Disk /dev/xvdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x75a9f100

Device Boot Start End Blocks Id System
/dev/xvdb1 1 13054 104856223+ 83 Linux

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-13054, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054):
Using default value 13054

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[ ~]# e2fsck -f /dev/xvdb1
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/xvdb1: 3120/5242880 files (8.7% non-contiguous), 670969/20970841 blocks
[ ~]# resize2fs /dev/xvdb1
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/xvdb1 to 26214055 (4k) blocks.
The filesystem on /dev/xvdb1 is now 26214055 blocks long.

- to blog -

blog built using the cayman-theme by Jason Long. LICENSE