簡體   English   中英

如何在AWS EC2 Rhel7 AMI上調整根分區的大小?

[英]How to resize root partition on aws ec2 rhel7 ami?

我從rhel7 ami-f7f03d80 ami創建了一個t2.micro實例,具有39gb gp2 xfs_ebs存儲,並具有6gb / xfs文件系統和24gb的可用空間。 我正在嘗試使用xfs_growfs -d /調整分區大小,它說data size unchanged, skipping 當我在-D 2572864指定-D 2572864時,它說data size 2572864 too large, maximum is 1572864 看來我需要先調整分區的大小,然后再調整文件系統的大小,但是我無法在已掛載的fs上執行此操作。 我可以將fdisk和xfs_growfs打包到initrd中,然后從中啟動,但這似乎太難了)好像我錯過了一些東西,可以用其他方法完成。 謝謝。

會感到有些恐懼(首先拍攝快照),但是:

fdisk /dev/YOURDEVICE

刪除分區,創建一個占用整個磁盤的新分區,寫入更改,然后重新啟動。

之后,您應該會看到整個驅動器。

我在RHEL 7上通過gdisk擴展了根分區空間

1)yum -y安裝gdisk

2)須藤gdisk / dev / xvda

刪除所有分區

3)

Command (? for help): o This option deletes all partitions and creates a new protective MBR. Proceed? (Y/N): Y

4)使用n命令為設備上的每個分區創建一個新的分區條目。

Command (? for help): n Partition number (1-128, default 1): 1 First sector (34-209715166, default = 2048) or {+-}size{KMGTP}: 2048 Last sector (2048-209715166, default = 209715166) or {+-}size{KMGTP}: 4095 Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): EF02 Changed type of partition to 'BIOS boot partition'

Command (? for help): n Partition number (2-128, default 2): 2 First sector (34-209715166, default = 4096) or {+-}size{KMGTP}: 4096 Last sector (4096-209715166, default = 209715166) or {+-}size{KMGTP}: 209715166 Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): 0700 Changed type of partition to 'Microsoft basic data'

5)使用w命令將更改寫入設備並退出。

Expert command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!

Do you want to proceed? (Y/N): Y OK; writing new GUID partition table (GPT) to /dev/xvda. The operation has completed successfully.

6)重新啟動系統7)重新啟動后,您可以看到/ root分區大小增加了

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM