Last active
December 11, 2020 02:14
-
-
Save kiquetal/5e926f204c866e986694a2940bf6e9de to your computer and use it in GitHub Desktop.
Particion ebs root HVM 2020 aws
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Luego de casi 2 días al fin pude particionar una instancia ebs root de aws | |
Primer paso | |
Recursos utilizados: | |
Un nuevo volumen (el que contendra los datos de un ebs volumen que ya corria) | |
Se utiliza el volumen de una instancia corriendo (la que queremos modificar) (tendremos que detener la instancia | |
y realizar un disattach ,ya que era un ebs root) | |
Se utiliza una instancia auxiliar(ec2-aux y volumen ec2-aux) | |
Se agregan los 2 volumenes a la instancia auxiliar (xdf y xdf) | |
se realiza la partición del volumen-nuevo | |
Device Start End Sectors Size Type | |
/dev/xvdg1 2048 4095 2048 1M BIOS boot | |
/dev/xvdg2 4096 8392703 8388608 4G Linux filesystem | |
/dev/xvdg3 8392704 12587007 4194304 2G Linux filesystem | |
La partición debe comenzar y terminar según la información anterior y seleccionar el tipo BIOS BOOT | |
con fdisk sería comman: t y luego 4 | |
formatear mkfs.xfs /dev/xvdg2 (o donde exista) | |
se copia la información del volumen que estaba corriendo a un punto de montaje del auxiliar | |
modificar la información de los etc/fstab | |
root@ubuntu:/mnt/xvdg1# sed -i -e 's/0f790447-ebef-4ca0-b229-d0aa1985d57f/6094350f-7d18-4256-b52e-6dbf5f196219/g' etc/fstab | |
root@ubuntu:/mnt/xvdg1# sed -i -e 's/0f790447-ebef-4ca0-b229-d0aa1985d57f/6094350f-7d18-4256-b52e-6dbf5f196219/g' boot/grub2/grub.cfg | |
Importantisimo, se corre el grub2-install luego del chroot y en el block device,no en la partición | |
root@ubuntu:/mnt/xvdg1# mount --bind /dev dev | |
root@ubuntu:/mnt/xvdg1# mount --bind /proc proc | |
root@ubuntu:/mnt/xvdg1# mount --bind /sys sys | |
root@ubuntu:/mnt/xvdg1# chroot . | |
[root@centos /]# grub2-install /dev/xvdg | |
gracias | |
https://www.raygibson.net/2017/06/30/shrinking-centos-7-ebs-boot-volume-on-aws/ | |
https://yabhinav.github.io/cloud/resize-root-partition-on-ec2-centos6hvmami/ | |
https://www.daniloaz.com/es/particionar-y-cambiar-el-tamano-del-volumen-raiz-ebs-de-una-instancia-aws-ec2/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ojo excluir las demás particiones para copiar lo que haya en el root original
amiroot=volumen original
myroot donde instalaremos toda la copia de amiroot con las particiones.
~# rsync -av /mnt/amiroot/home/ /mnt/myroot/home/
~# rsync -av /mnt/amiroot/usr/ /mnt/myroot/usr/
~# rsync -av /mnt/amiroot/var/ /mnt/myroot/var/
~# rsync -av --exclude=home --exclude=usr --exclude=var /mnt/amiroot/ /mnt/myroot/root/
~# mkdir /mnt/myroot/root/home;chmod 755 /mnt/myroot/root/home
~# mkdir /mnt/myroot/root/usr;chmod 755 /mnt/myroot/root/usr
~# mkdir /mnt/myroot/root/var;chmod 755 /mnt/myroot/root/var/////