Skip to content

Instantly share code, notes, and snippets.

@rlaace423
Last active November 18, 2019 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlaace423/51b0d86887e01f7e46f83c31df35b6f1 to your computer and use it in GitHub Desktop.
Save rlaace423/51b0d86887e01f7e46f83c31df35b6f1 to your computer and use it in GitHub Desktop.
resize_partition.sh
########################################################
#
##### Overall Steps #####
#
# (shutdown)
# 1. ncloud 콘솔에서 "디스크" 크기 확장
# (boot, umount)
# 2. 디스크의 "파티션" 크기를 확장된 디스크 크기만큼 키우기
# 3. 해당 파티션의 "파일 시스템" 크기를 확장된 파티션 크기만큼 키우기
# (mount)
########################################################
# 먼저 서버 종료 후, ncloud 콘솔에서 디스크 크기 키우기
# 증가된 block device 크기 확인
lsblk
# or
fdisk -l
# 마운트 해제
umount /dev/xvdb1
# 마운트 해제 확인
lsblk
# 파티션 크기 확장 (1번 파티션일 경우)
growpart /dev/xvdb 1
# 확장 확인
lsblk
# 파일 시스템 확장 전 대상 파티션의 파일 시스템 상태를 확인 (ext 파일 시스템일 경우)
e2fsck -f /dev/xvdb1
# 파일 시스템 확장 (ext 파일 시스템일 경우)
# 커진 파티션 크기만큼 파일 시스템이 resize 됨.
resize2fs /dev/xvdb1
# 파티션 마운트
mount -a
# 확인
df -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment