viernes, 11 de abril de 2025

UEFI Partition





Moving Your EFI Partition to the End of the Disk - Revised Plan

Based on the accurate disk information:Disk /dev/sda: 223.57 GiB, 240057409536 bytes, 468862128 sectors Device Start End Sectors Size Type /dev/sda1 2048 292972543 292970496 139.7G Linux filesystem /dev/sda2 292972544 295174143 2201600 1G EFI System


I can now provide a correct procedure for moving your EFI partition to the end of the disk.
Step-by-Step Process
1. PreparationBack up your entire system before proceeding
Create a bootable recovery USB with a Linux distribution
2. Back Up Your EFI Partition Contents# Create backup directory sudo mkdir -p /home/alejandro/efi_backup # Copy all EFI contents with proper permissions sudo cp -a /boot/efi/* /home/alejandro/efi_backup/ # Verify the backup ls -la /home/alejandro/efi_backup/

3. Create New EFI Partition at the End of the Disk

You can do this from your running system, but you'll need to unmount the EFI partition first:# Check if the EFI partition is mounted mount | grep efi # If it is mounted, unmount it sudo umount /boot/efi


Now create the new partition:sudo parted /dev/sda


In parted:(parted) print (parted) mkpart primary fat32 466660528s 468862127s (parted) name 3 "EFI System" (parted) set 3 esp on (parted) print (parted) quit


Note: I've placed the new partition at the very end of the disk, leaving a small margin from the absolute end. The start sector (466660528) is calculated to create a 1GB partition similar to your current EFI partition.
4. Format the New EFI Partitionsudo mkfs.fat -F32 /dev/sda3

5. Mount and Copy EFI Contents# Create mount point for the new EFI partition sudo mkdir -p /mnt/new_efi # Mount the new EFI partition sudo mount /dev/sda3 /mnt/new_efi # Copy the contents from the backup sudo cp -a /home/alejandro/efi_backup/* /mnt/new_efi/ # Verify the copy ls -la /mnt/new_efi/

6. Update the fstab File

Get the UUID of the new EFI partition:NEW_UUID=$(sudo blkid -s UUID -o value /dev/sda3) echo $NEW_UUID # Note this UUID for the next step


Edit the fstab file:# Backup the original fstab sudo cp /etc/fstab /etc/fstab.backup # Edit fstab (replace OLD_UUID with the UUID of your current EFI partition) sudo sed -i "s|UUID=OLD_UUID|UUID=$NEW_UUID|" /etc/fstab # Alternatively, edit manually sudo nano /etc/fstab

7. Update the Boot Configuration# Mount the new EFI partition to /boot/efi sudo mount /dev/sda3 /boot/efi # Update the bootloader sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB sudo update-grub

8. Update UEFI Boot Entries# List current boot entries sudo efibootmgr -v # Create a new boot entry for the new EFI partition sudo efibootmgr --create --disk /dev/sda --part 3 --label "GRUB" --loader '\EFI\GRUB\grubx64.efi' # Optionally, remove old entries (replace X with the number of the old entry) sudo efibootmgr -b X -B

9. Reboot and Test

Reboot your system and verify it boots correctly with the new EFI partition.
10. Remove the Old EFI Partition

Only after confirming successful boot:sudo parted /dev/sda


In parted:(parted) print (parted) rm 2 (parted) print (parted) quit

Additional Notes

UEFI Firmware Access: If your system doesn't boot after the change, you may need to enter your UEFI firmware settings (often by pressing F2, Del, or Esc during boot) and adjust the boot order to prioritize the new EFI partition.


Dual-Boot Considerations: If you're dual-booting with Windows or another OS, you'll need to update its boot configuration as well.


Recovery Option: If something goes wrong, you can boot from your live USB, mount your root partition, and restore the original EFI configuration using your backup.


Alternative Approach: If you encounter issues, you could also consider using a tool like Clonezilla to clone the entire disk, repartition it with the EFI at the end, and then restore the data.

This revised procedure should work with your actual disk layout. The key difference is that we now have accurate information about the disk size and available space, allowing us to correctly place the new EFI partition at the end of the disk.



miércoles, 9 de abril de 2025

Kubernetes - Passing multiple commands to the container

You can send multiple entrypoint commands to a Docker container in the command tag of kubernetes config file.

command: ["/bin/sh","-c"]
args: ["command one; command two && command three"]