Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[FEATURE REQUEST] Resize the existing partition instead of format the drive
#1
I know you haven't added that support yet because you don't want a headache with users losing their data and blaming you, but I don't see why not adding a parameter to resize and install Ventoy keeping current data. You just need to make it clear that the user is responsible for any data loss. Today I did it manually on my external HD and it worked perfectly, if anyone wants to try it, here are the instructions:

To boot with UEFI:

  1. Install Ventoy on any flash drive and make a dd backup of the second partition EFI that Ventoy created on the flash drive
    Code:
    sudo dd if=/path/to/the/part2/of/ventoy/flash/drive of=part2-EFI.img

  2. Resize the NTFS partition of the external HD using Gparted or any similar tool, leaving 32MB at the end of the disk and then create an ext4 partition in that space (on the first attempt Gparted failed because my NTFS partition had some errors, I had to restart on Windows first and run the command "chkdsk /f /x H:" on my external HD to correct these errors).
  3. Restore the dd backup of the second partition EFI on the second partition that you created before
    Code:
    sudo dd if=part2-EFI.img of=/path/to/the/part2/of/external/hd

To boot with Legacy BIOS:
       
  1. First you need to follow all the steps for UEFI
  2. Backup the first 1MiB of a flash drive created by Ventoy
    Code:
    sudo dd if=/path/to/ventoy/flash/drive of=VentoyMBRandGAP.img bs=1MiB count=1

  3. Backup the original MBR of the external HD as a precaution in case something goes wrong
    Code:
    sudo dd if=/path/to/external/hd of=OriginalMBRandGAP.img bs=1MiB count=1

  4. Backup the original partition table of the external HD
    Code:
    sudo dd if=/path/to/external/hd of=OriginalPartitionTable.img skip=446 bs=1 count=64

  5. First you have to check by GParted that your first partition starts in sector 2048 (1048576 bytes). If yes, you can restore the VentoyMBRandGAP.img to the external HD
    Code:
    sudo dd if=VentoyMBRandGAP.img of=/path/to/external/hd bs=1MiB count=1

  6. Restore his original partition table
    Code:
    sudo dd if=OriginalPartitionTable.img of=/path/to/external/hd seek=446 bs=1 count=64

  7. Use fdisk to change the partition 2 type and set the boot flag (you need to paste all lines at once on terminal and press enter)
    Code:
    echo "t
    2
    ef
    a
    1
    w" | sudo fdisk /path/to/external/hd

Notes:
When I say "/path/to/ventoy/flash/drive" or "/path/to/external/hd" I mean the path of the entire block device such as "/dev/sdb" or "/dev/sdc".
When I say "/path/to/the/part2/of/ventoy/flash/drive" or "/path/to/the/part2/of/external/hd" I mean the path of the specific partition block such as "/dev/sdb2" or "/dev/sdc2"
You can find these values on your system using the lsblk command
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)