resize2fs comando não encontrado

3

Eu quero redimensionar o volume de raiz do EC2 EBS, tentei instalar o e2fsprogs mas ele ainda não foi encontrado. Estou usando o Debian 8.

Como instalo esta aplicação?

    
por Nguyen Tien Huy 10.04.2017 / 06:59

2 respostas

1

Como mencionado nos comentários, resize2fs pode estar localizado em sbin (esse também foi o caso da minha instância do EC2). Você pode alterar seu PATH ou cd /sbin , em seguida, resize2fs . Você pode então redimensionar o volume da raiz do EC2 EBS com resize2fs .

    
por 26.10.2018 / 02:49
1

Parafraseando a partir de Matt Berther's "Como redimensionar o AWS EC2 Volumes EBS "

Shrinking an EBS Volume

When you wish to shrink an EBS root volume, you will need to start a new, small EC2 instance that you can attach the volume you wish to resize. A t2.micro instance should be more than sufficient for this task. Once you have this instance created, proceed with the following steps.

  1. Always Prefer to take backup, stop your EC2 instance and take a snapshot.

  2. Create a new EBS volume that is the size you wish to shrink to

  3. Detach the volume you wish to resize from the current EC2 instance and attach both volumes to the new, small EC2 instance you created
    • Mount the old volume as /dev/sdf (this becomes /dev/xvdf)
    • Mount the new volume as /dev/sdg (this becomes /dev/xvdg)
  4. Power on the new, small instance and wait for it to come online
  5. SSH into the instance and run the following commands
  6. To ensure that the file system is in order, run sudo e2fsck -f /dev/xvdf1. If you're resizing a different partition on the drive, change the number 1 to the partition number you wish to resize.

  7. If the e2fsck command ran without errors, now run sudo resize2fs -M -p /dev/xvdf1. Again, change the 1 to the partition number you wish to resize if you're not resizing the first one.

  8. The last line from the resize2fs command should tell you how many 4k blocks the filesystem now is. To calculate the number of 16MB blocks you need, use the following formula: blockcount * 4 / (16 * 1024). Round this number up to give yourself a little buffer.

  9. If you dont yet have a partition on your new volume (/dev/xvdg1), use fdisk to create one.
  10. Execute the following command, using the number you came up with in the previous step.

    sudo dd bs=16M if=/dev/xvdf1 of=/dev/xvdg1 count=numberfrompreviousstep
    

    Depending on how large your volume is this may take several minutes to run -- let it finish.

  11. After the copy finishes, resize and check and make sure that everything is in order with the new filesystem by running

    sudo resize2fs -p /dev/xvdg1 && sudo e2fsck -f /dev/xvdg1
    
  12. After this step is complete, detach both volumes from the new instance you created. Attach the shrunken volume to the old EC2 instance as /dev/sda1 (your boot device) and restart your old instance. Save the previous, larger volume until you've validated that everything is working properly. When you've verified things are working well, feel free to delete the new EC2 instance you created, plus the larger volume and snapshot.

Expanding an EBS Volume

Expanding the size of an EBS volume is a bit easier, since we dont have to execute a disk-disk copy. To expand the size of the volume, execute the following steps:

  1. Please take EC2 instance and take a snapshot.

  2. Create a new EBS volume from the snapshot specifying the new, larger size

  3. Attach the new EBS volume to your existing EC2 instance, as /dev/sda1 if this is the root volume
  4. Power on your existing instance and wait for it to come online
  5. SSH into the instance and run the following commands
  6. To ensure that the file system is in order and run sudo e2fsck -f /dev/xvda1. If you're resizing a different partition on the drive, change the number 1 to the partition number you wish to resize.
  7. If the e2fsck command ran without errors, now run sudo resize2fs -p /dev/xvda1. Again, change the 1 to the partition number you wish to resize if you're not resizing the first one.
  8. Save the previous, smaller volume and the snapshot until you've validated that everything is working properly. When you've verified things are working well, feel free to delete the original volume and snapshot.

I hope these instructions were able to help you.

Se você ainda quer instalar o e2fsprogs, experimente o método abaixo.

sudo apt-get install e2fsprogs

Se você não conseguir instalar a partir do apt, tente este link

    
por 10.04.2017 / 07:23