grub4dos icon indicating copy to clipboard operation
grub4dos copied to clipboard

partnew cannot replace a partition

Open steve6375 opened this issue 2 years ago • 18 comments

image

Why does partnew not allow a current partition to be replaced by a file? A1ive's grubfm allows this but not grub4dos.

This seems to be a bug. It is a valid command.

steve6375 avatar Sep 12 '22 07:09 steve6375

This is for security reasons. Overwriting an existing partition entry is not allowed.

yaya2007 avatar Sep 13 '22 06:09 yaya2007

It is needed to overwrite an existing partition. e.g. for UEFI booting, all partitions in the MBR must be in ascending order.

so if we have

Ptn1: STARTLBA=2048 SIZE=7000000 (file=x.imgptn) Ptn2: empty Ptn3: empty Ptn4: empty

We cannot use partnew for partnew (hd0,1) 0x0 /x.imgptn because then we get

Ptn1: StartLBA=2048 SIZE=7000000 (file=x.imgptn) Ptn2: StartLBA=340567 SIZE=20000 Ptn3: empty Ptn4: empty

So the new MBR is invalid because Ptn2 is overlapping Ptn1 and a UEFI BIOS will not see the disk as valid.

So we MUST allow partnew to overwrite existing partition - otherwise the partnew command is useless.

Check code in builtins.c needs to be removed (or at least allow a file which is in same partition to overwrite MBR entry).

steve6375 avatar Sep 13 '22 07:09 steve6375

maybe add --force parameter?

steve6375 avatar Sep 13 '22 11:09 steve6375

We want to be together

yaya2007 avatar Sep 13 '22 21:09 yaya2007

BOOTX64.rar.txt

yaya2007 avatar Sep 14 '22 00:09 yaya2007

need grub4dos modified.

steve6375 avatar Sep 14 '22 05:09 steve6375

bootx64.rar

Seems to work OK using --force. Thanks. Please can we have same for grub4dos too so we can switch in FAT32 UEFI bootable partitions from legacy mode, etc.

steve6375 avatar Sep 14 '22 10:09 steve6375

Issued together after modification

yaya2007 avatar Sep 14 '22 13:09 yaya2007

Published

yaya2007 avatar Sep 15 '22 00:09 yaya2007

Published

Thank you so much.

anwar-alsilwy avatar Sep 15 '22 02:09 anwar-alsilwy

Thanks P.S. hotkey still not displaying global hotkeys image

steve6375 avatar Sep 15 '22 07:09 steve6375

I tested normal. How to reproduce the problem?

yaya2007 avatar Sep 16 '22 01:09 yaya2007

OK - I think the problem is that the two versions are not compatible. I was using 2022-07-19 to define hotkeys and 2022-09-15 to display them. So it is not a real issue.

However, it should not need debug 2 to display the hotkeys. The old version of hotkey would display the global hotkeys with just debug 0 or debug 1. It is useful for the user to be able to see which global hotkeys have been defined and he does not know to set debug 2.

steve6375 avatar Sep 16 '22 07:09 steve6375

Version 2022-07-25 began to change. When debug=1, the global hotkey is displayed.

You posted a post asking: "How can I get extra help information?", Therefore, the limit of "debug>1" is added according to your meaning.

yaya2007 avatar Sep 16 '22 08:09 yaya2007

image Old version did not require debug 2 New version does require debug >1 global hotkeys should be displayed regardless of debug setting as in old version.

steve6375 avatar Sep 16 '22 08:09 steve6375

Again, it was changed to this at your request.

commented on 24 Jul https://github.com/chenall/grub4dos/issues/365

yaya2007 avatar Sep 16 '22 08:09 yaya2007

I was commenting on the extra debug numbers that are printed as circled in red in the screenshot I did not mean for you to remove the hotkey list image

steve6375 avatar Sep 16 '22 09:09 steve6375

Chenall's hotkey-2013-10-16, that's it. Those are all debugging information. hotkey.rar.txt

yaya2007 avatar Sep 16 '22 23:09 yaya2007