CentOS root volume Resize
EC2 의 CENTOS 의 경우 8G 정도의 Root 볼륨이 할당됩니다. 약간 작아 20G로 resize2fs 시켜 사용중이었는데 6.7 버전부터 resizefs /dev/xvda1 을 하면
The filesystem is already 2096896 blocks long. Nothing to do!
라는 메세지가 발생합니다.
이를 해결하기 위해 아래의 방법을 실행합니다.
이는 시작 섹터를 변경하여 이전 파티션을 삭제하고 동일한 파티션 번호를 새로 생성하게 하는 것입니다. 잘못될 경우 부팅에 실패할 수 있으므로, 사용 중인 시스템에서는 백업이 필수라 여겨집니다.
[root@cateye ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 20G 0 disk
└─xvda1 202:1 0 8G 0 part /
[root@cateye ~]# resize2fs /dev/xvda1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 2096896 blocks long. Nothing to do!
[root@cateye ~]# resize2fs /dev/xvda
resize2fs 1.41.12 (17-May-2010)
resize2fs: Device or resource busy while trying to open /dev/xvda
Couldn't find valid filesystem superblock.
[root@cateye ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 943M 6.5G 13% /
tmpfs 938M 0 938M 0% /dev/shm
[root@cateye ~]# fdisk /dev/xvda
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): u
Changing display/entry units to sectors
Command (m for help): p
Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00057cbb
Device Boot Start End Blocks Id System
/dev/xvda1 * 2048 16777215 8387584 83 Linux
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-41943039, default 63): 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): ENTER
Using default value 41943039
Command (m for help): p
Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00057cbb
Device Boot Start End Blocks Id System
/dev/xvda1 2048 41943039 20970496 83 Linux
Command (m for help): a
Partition number (1-4): 1
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@cateye ~]# reboot
Broadcast message from root@cateye
[root@cateye ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 20G 0 disk
└─xvda1 202:1 0 20G 0 part /
[root@cateye ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 20G 947M 18G 5% /
tmpfs 938M 0 938M 0% /dev/shm
위의 내용은 제가 직접 실행한 내용이고, 아래에 설명을 따라했습니다. 가급적이면 원본 사이트에가서 참조하시기 바랍니다.
To expand on JD's self-accepted answer, here's exactly what to do:
df -h
#print the name of your boot partition
lsblk
#show info on all your block devices
You'll see from that output what the name of the disk is of your root partition. For example, you probably see something like this:
xvde 202:64 0 32G 0 disk
└─xvde1 202:65 0 8G 0 part /
Our goal is to make xvde1
use the whole available space from xvde
. Here's how your resize your partition:
fdisk /dev/xvda
(the disk name, not your partition) This enters into the fdisk
utility.
u
#Change the display to sectorsp
#Print infod
#Delete the partitionn
#New partitionp
#Primary partition1
#Partition number2048
#First sector- Press Enter to accept the default
p
#Print infoa
#Toggle the bootable flag1
#Select partition 1w
#Write table to disk and exit
Now, reboot your instance: reboot
After it comes back do:
resize2fs /dev/xvde1
(the name of your partition, not the block device)
And finally verify the new disk size: df -h
1 출처는 여기
http://stackoverflow.com/questions/26770655/ec2-storage-attached-at-sda-is-dev-xvde1-cannot-resize
'Cloud > AWS' 카테고리의 다른 글
[AWS] Aurora Database Failover 유의사항 (0) | 2018.03.29 |
---|---|
AWS 스터디 및 공부방법 링크 (0) | 2016.11.22 |
[AWS] RDS Root 권한 획득 (0) | 2016.01.29 |
[AWS] Auto Scaling Group내 AMI, Instance Type 변경하기 (0) | 2016.01.13 |
[AWS] Region간 Migrion 방법론 (0) | 2016.01.10 |