블로그 이미지
분무기로 구름을 만들어 비가 내리다. 비내리는사막

카테고리

분류 전체보기 (28)
Cloud (9)
IT용어 (1)
뽐뿌 (1)
개인 (1)
Total
Today
Yesterday

달력

« » 2024.11
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

공지사항

최근에 올라온 글

CentOS root volume Resize

Cloud/AWS / 2018. 2. 9. 11:47

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.

  1. u #Change the display to sectors
  2. p #Print info
  3. d #Delete the partition
  4. n #New partition
  5. p #Primary partition
  6. 1 #Partition number
  7. 2048 #First sector
  8. Press Enter to accept the default
  9. p #Print info
  10. a #Toggle the bootable flag
  11. 1 #Select partition 1
  12. w #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

Posted by 비내리는사막
, |

최근에 달린 댓글

글 보관함