Re: fdisk flag bootable partition during install
On Tue, 2012-04-24 at 23:35 +0200, Louis V. Lambrecht wrote: On Tue, 2012-04-24 at 22:52 +0200, Erling Westenvik wrote: On Tue, Apr 24, 2012 at 08:14:19PM +0200, Alexander Hall wrote: You do not flag which to use. Multiple A6 entries brings problems since you get multiple disklabels. Trust me: I'll remember that in the future. I am pretty sure this is documented and in the faq and archives. Maybe so, at least implicit, but I dare to say not explicit. I don't blame anyone but myself though. You could try setting the partition not to be used to some other dummy type. Backup first. Ymmv. I tried setting fdisk partition 1 back to NTFS (0x07). Then, after quitting fdisk, the system complained about missing parameteres when trying to run reboot, halt and eventually shutdown. I managed to reboot somehow but then no kernel was found. I then booted from CD and managed to get the system back online with the two multiple A6 entries. 1. When I used flag 1 in fdisk during install, did the installer place the new files in fdisk partition 1? 2. If so, does the original 5.0 installation still exists in fdisk partition 2? 3. If so, can my original disklabel be restored? Cheers Erling First read the FAQ 14.7, notice the What can go wrong chapter and fdisk with the -u option and run installboot(8) from the proper label. Man boot(8) EXAMPLES boot boot hd2a:/bsd should get you in your large partition. In most cases, when installing an OS, most rewrite the MBR: last install wins. Oops, after a good sleep, noticed an error: hard drive hd0 remains hd0 whatever the labels. Can't figure out the label. Sorry. Now, stop playing with fdisk until you know what you are doing. :-6 Would have prefered to give you a plain OpenBSD solution. Instead download a copy of RIP-Linux (CDRom or USB) or GAG (floppy). What they do is to boot by-passing your (now whacked) fdisk. Both will discover the PBRs (Partition Boot Record) and let you boot from without writing anything to the drive (unless you say so). Repair your Win7: http://techchand.org/92/how-to-fix-bootmgr-error-in-windows-vista-and-windows-7 It is a PITA but possible to point to any PBR (henceyour OBSD sessions0 from within Windows boot manager. Must be free tools around.
Re: fdisk flag bootable partition during install
Thank you for your time everyone. Especially Gregor Best who pointed me in the right direction. I managed to get hold on the old 5.0 RELEASE in fdisk partition 2. However, afterwards I managed to do unspeakable things.. I learned a lot though. It's a first time for everything! :-D On Tue, Apr 24, 2012 at 11:12:55PM +0200, Gregor Best wrote: On Tue, Apr 24, 2012 at 10:52:26PM +0200, Erling Westenvik wrote: 1. When I used flag 1 in fdisk during install, did the installer place the new files in fdisk partition 1? IIRC, behaviour with more than one A6 partition is undefined, but I'd say so, since it was the first A6 the kernel encountered on that disk. Strictly speaking, partition 1 wasn't the first A6 partition the kernel encountered since it was marked as 07 during CD boot, and was first changed to 0xA6 live during install, without rebooting in between? 2. If so, does the original 5.0 installation still exists in fdisk partition 2? May be. It did. Cheers, Erling
Re: fdisk flag bootable partition during install
On Tue, Apr 24, 2012 at 08:47:05PM -0600, Theo de Raadt wrote: [...] Undefined? Sorry. But if you go look at the code, that is exactly how it works. Some might not like it. But that is how it works, at this time. I don't know what the word undefined means in that context. [...] Hence the IIRC. Apparently I did not completely remember correctly :) -- Gregor Best [demime 1.01d removed an attachment of type application/pgp-signature]
Re: fdisk flag bootable partition during install
Erling Westenvik erling.westen...@gmail.com wrote: Please ignore and forgive my obviously unforgivable ignorance: I wanted to test a snapshot of OpenBSD 5.1 on my ThinkPad T500 which runs 5.0 Release. I decided to overwrite the Windows 7 installation which I never use anyway. fdisk(8) before installation was more or less like this: #: id C H S - C H S [start: size ] 0: 07 1 11 5 - 109 59 12 [ 2048: 204800 ] NTFS 1: 07 109 59 13 - 41336 1 2 [ 206848: 77918208 ] NTFS *2: A6 41336 1 3 - 82669 114 10 [ 78125056: 78120960 ] OpenBSD 3: 00 0 0 0 - 0 0 0 [0:0 ] unused During install, when prompted for which partition to use, I selected the run fdisk-option and used the +edit 1; to set partition 1 to type A6, and +flag 1;-command to make it the active and bootable partition like this: #: id C H S - C H S [start: size ] 0: 07 1 11 5 - 109 59 12 [ 2048: 204800 ] NTFS *1: A6 109 59 13 - 41336 1 2 [ 206848: 77918208 ] OpenBSD 2: A6 41336 1 3 - 82669 114 10 [ 78125056: 78120960 ] OpenBSD 3: 00 0 0 0 - 0 0 0 [0:0 ] unused I'm almost certain I have done it like this earlier? I mean: just marking the partition to use with +flag n;, upon which the installer used that partition for creating layout with disklabel(8), leaving other partitions untouched? You do not flag which to use. Multiple A6 entries brings problems since you get multiple disklabels. I am pretty sure this is documented and in the faq and archives. You could try setting the partition not to be used to some other dummy type. Backup first. Ymmv. /Alexander The rest of the installation went well as always with disklabel using the default layout. However, when I wanted to boot into my 5.0 and hence used the +flag 2;-command in fdisk(8), the system still booted into the new 5.1. Now it doesn't matter if I run +flag 1; or +flag 2; -- the system boots into 5.1 anyway. Regards, Erling
Re: fdisk flag bootable partition during install
On Tue, Apr 24, 2012 at 08:14:19PM +0200, Alexander Hall wrote: You do not flag which to use. Multiple A6 entries brings problems since you get multiple disklabels. Trust me: I'll remember that in the future. I am pretty sure this is documented and in the faq and archives. Maybe so, at least implicit, but I dare to say not explicit. I don't blame anyone but myself though. You could try setting the partition not to be used to some other dummy type. Backup first. Ymmv. I tried setting fdisk partition 1 back to NTFS (0x07). Then, after quitting fdisk, the system complained about missing parameteres when trying to run reboot, halt and eventually shutdown. I managed to reboot somehow but then no kernel was found. I then booted from CD and managed to get the system back online with the two multiple A6 entries. 1. When I used flag 1 in fdisk during install, did the installer place the new files in fdisk partition 1? 2. If so, does the original 5.0 installation still exists in fdisk partition 2? 3. If so, can my original disklabel be restored? Cheers Erling
Re: fdisk flag bootable partition during install
On Tue, Apr 24, 2012 at 10:52:26PM +0200, Erling Westenvik wrote: [...] 1. When I used flag 1 in fdisk during install, did the installer place the new files in fdisk partition 1? [...] IIRC, behaviour with more than one A6 partition is undefined, but I'd say so, since it was the first A6 the kernel encountered on that disk. [...] 2. If so, does the original 5.0 installation still exists in fdisk partition 2? [...] May be. [...] 3. If so, can my original disklabel be restored? [...] Your original disklabel should still be intact if my answer to your first question turns out to be true. I think most of your issues come from the bootloader that was installed when you did the 5.1 install. IIRC, the offset pointing to the A6 partition is stored directly inside the bootloader, which means that it has to be restored to point back to the second A6. The proper course of action would thus be: * Boot from a bsd.rd and enter the shell * Use fdisk to change the partition type of your first A6 (the one that contains 5.1) to something else. * Write, the leave fdisk and use disklabel -c wd0c to tell the kernel to re-read the disklabel (replacing wd0c with your disk of course) * Re-install the bootloader as described in the boot(8) manpage (you might want to print that before doing the routine, bsd.rd does not contain man pages). * Reboot and pray -- Gregor Best [demime 1.01d removed an attachment of type application/pgp-signature]
Re: fdisk flag bootable partition during install
On Tue, 2012-04-24 at 22:52 +0200, Erling Westenvik wrote: On Tue, Apr 24, 2012 at 08:14:19PM +0200, Alexander Hall wrote: You do not flag which to use. Multiple A6 entries brings problems since you get multiple disklabels. Trust me: I'll remember that in the future. I am pretty sure this is documented and in the faq and archives. Maybe so, at least implicit, but I dare to say not explicit. I don't blame anyone but myself though. You could try setting the partition not to be used to some other dummy type. Backup first. Ymmv. I tried setting fdisk partition 1 back to NTFS (0x07). Then, after quitting fdisk, the system complained about missing parameteres when trying to run reboot, halt and eventually shutdown. I managed to reboot somehow but then no kernel was found. I then booted from CD and managed to get the system back online with the two multiple A6 entries. 1. When I used flag 1 in fdisk during install, did the installer place the new files in fdisk partition 1? 2. If so, does the original 5.0 installation still exists in fdisk partition 2? 3. If so, can my original disklabel be restored? Cheers Erling First read the FAQ 14.7, notice the What can go wrong chapter and fdisk with the -u option and run installboot(8) from the proper label. Man boot(8) EXAMPLES boot boot hd2a:/bsd should get you in your large partition. In most cases, when installing an OS, most rewrite the MBR: last install wins.
Re: fdisk flag bootable partition during install
1. When I used flag 1 in fdisk during install, did the installer place the new files in fdisk partition 1? [...] IIRC, behaviour with more than one A6 partition is undefined, but I'd say so, since it was the first A6 the kernel encountered on that disk. Undefined? Sorry. But if you go look at the code, that is exactly how it works. Some might not like it. But that is how it works, at this time. I don't know what the word undefined means in that context.
Re: fdisk flag bootable partition during install
On Tue, Apr 24, 2012 at 08:14:19PM +0200, Alexander Hall wrote: You do not flag which to use. Multiple A6 entries brings problems since you get multiple disklabels. Perhaps it's worthwhile for fdisk to sanity check for errors like this before writing out an MBR? Index: cmd.c === RCS file: /home/mdempsky/anoncvs/cvs/src/sbin/fdisk/cmd.c,v retrieving revision 1.46 diff -u -p -r1.46 cmd.c --- cmd.c 11 Nov 2011 18:21:06 - 1.46 +++ cmd.c 25 Apr 2012 03:00:16 - @@ -328,7 +328,16 @@ int Xwrite(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) { char mbr_buf[DEV_BSIZE]; - int fd; + int fd, i, n; + + for (i = 0, n = 0; i NDOSPART; i++) + if (mbr-part[i].id == 0xA6) + n++; + if (n = 2) { + warnx(MBR contains more than one OpenBSD partition!); + if (!ask_yn(Write MBR anyway?)) + return (CMD_CONT); + } fd = DISK_open(disk-name, O_RDWR); MBR_make(mbr, mbr_buf);