【问题标题】:Not able to resize the AWS EC2 volume无法调整 AWS EC2 卷的大小
【发布时间】:2017-03-12 16:25:42
【问题描述】:

我创建了一个具有 8GB 根卷的 AWS EC2 Linux 实例。然后我将 EBS 卷增加到 9GB,它进入了完成状态。这是一个小卷,所以调整大小需要几分钟才能完成。

现在我尝试在使用here 中提到的说明调整卷大小后扩展 linux 文件系统。但是,我收到以下错误消息。我试了两次,整个过程。但都是一样的。

The filesystem is already 2096635 (4k) blocks long.  Nothing to do!

这是图片的屏幕截图。

有人可以帮我吗?

【问题讨论】:

    标签: linux amazon-web-services amazon-ec2 filesystems


    【解决方案1】:

    只需重启实例,因为它会在启动时自动调整根文件系统的大小。

    我自己试过了。这是一个 8GB 卷的实例:

    [ec2-user@ip-172-31-15-216 ~]$ lsblk
    NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    xvda    202:0    0   8G  0 disk 
    └─xvda1 202:1    0   8G  0 part /
    
    [ec2-user@ip-172-31-15-216 ~]$ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    devtmpfs        236M   56K  236M   1% /dev
    tmpfs           246M     0  246M   0% /dev/shm
    /dev/xvda1      7.8G  985M  6.7G  13% /
    

    修改 EBS 卷后:

    [ec2-user@ip-172-31-15-216 ~]$ lsblk
    NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    xvda    202:0    0   9G  0 disk 
    └─xvda1 202:1    0   8G  0 part /
    
    [ec2-user@ip-172-31-15-216 ~]$ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    devtmpfs        236M   56K  236M   1% /dev
    tmpfs           246M     0  246M   0% /dev/shm
    /dev/xvda1      7.8G  985M  6.7G  13% /
    

    重启后:

    [ec2-user@ip-172-31-15-216 ~]$ lsblk
    NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    xvda    202:0    0   9G  0 disk 
    └─xvda1 202:1    0   9G  0 part /
    
    [ec2-user@ip-172-31-15-216 ~]$ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    devtmpfs        236M   56K  236M   1% /dev
    tmpfs           246M     0  246M   0% /dev/shm
    /dev/xvda1      8.8G  984M  7.7G  12% /
    

    另请参阅:increase EC2 EBS volume after cloning - resize2fs not working

    【讨论】:

      【解决方案2】:
      # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/storage_expand_partition.html
      # Before goging to do this, detach and attach the root volume to anothe instance
      # Note:
      #   1) Before detach the volume, please make a note of device name which going to
      #      detch from the machine, why because we should mention same name when attaching back, otherwise data will be lost
      #   2)
      
      # Identifying device name which we want to expand
      lsblk
      
      # Running parted command on the device
      sudo parted /dev/xvdf
      
      # Changing the parted units of measure to sectors.
      unit s
      
      # Run the print command to list the partitions on the device
      print
      # if it shows warning, chose fix
      
      # Delete the partition entry for the partition using the number (1) from the previous step
      rm 1 # number 1 will change based the partition we want to delete
      
      # Create a new partition that extends to the end of the volume
      mkpart Linux 4096s 100%
      
      # Run the print command again to verify your partition
      print
      
      # Check to see that any flags that were present earlier are still
      # present for the partition that you expanded. In some cases the boot
      # flag may be lost. If a flag was dropped from the partition when it was expanded,
      # add the flag with the following command, substituting your partition number and the flag name.
      # For example, the following command adds the boot flag to partition 1
      set 1 boot on
      
      #Run the quit command to exit parted.
      quit
      
      # verfiying the device
      sudo e2fsck -f /dev/xvdf1
      

      【讨论】:

      • 在进行上述步骤之前。您显示从源机器分离并附加到另一台机器。完成上述步骤后,重新附加与源机器相同的卷
      猜你喜欢
      • 2012-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-21
      • 1970-01-01
      • 2015-09-23
      • 2011-12-30
      相关资源
      最近更新 更多