DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 10th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default more than four primary partitions?

Hello,
Maybe this is a general question not related only to OpenBSD (4.5 release), but since I'm running OpenBSD I'll still post here.

I finally made up a reasonable set up in my new Tinkpad, keeping Vista (sometimes you can't really do without Windows, especially when some friends cannot understand why a computer should run a different OS...), shrinking it with gparted and installing OpenBSD.

The problem:
Now I have four primary partitions in mbr, three of them are taken by Vista and Lenovo stuff, one is for OpenBSD. I left quite a lot of space free, thinking of making an ext2 partitions to share files between Vista and OpenBSD. But I see that fdisk only has four slots. In Vista, the free space is recognized, and maybe I could format it to ext2, but then will OpenBSD see it?
At the beginning, I also wanted to install Opensuse, which I tried in qemu, and quite like it, so just to give a try to linux. But I see that linux makes even more partitions inside mbr, so that then OpenBSD's fdisk does not see all the partitions.
Although I've read some wikis and tutorials on the web, I think I still miss some basics. Will something like gag solve this kind of problem? (I presently use Vistas boot manager).
But again, will OpenBSD see a partition that exceeds the fdisk's four slots?
Reply With Quote
  #2   (View Single Post)  
Old 10th August 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

With MBR partitioning, you can have 3 "primary" partitions and 1 "extended" partition.. an extended partition is essentially a link to an additional partition table that again can have an additional 3 primary, 1 extended partition. (..this can keep going for quite a bit unfortunately.).

You already have 4 primary partitions, another variation.. thus you cannot create any extended partitions..

This can be quite confusing, and perhaps a GUI partitioning tool might be able to simplify it.. but the gist of what I'm telling you is that you'll need to repartition your disk, having 3 MBR partitions for Vista and for your laptops utility partition.. and the last partition being extended, afterword you can add a partition for OpenBSD and one for the EXT2/Linux stuff.

OpenBSD 4.5 supports being installed on extended partitions now, and fdisk(8) has supported manipulation of such tables for some time as well.

Please search for the "COMMAND MODE" section in that man page for more information about switching between extended table views.

OpenBSD creates "fictitious" disklabel entries for foreign partitions it finds.. but I have not confirmed that it recurses through extended partition tables.

Can anyone comment on this? I never install more then one operating system on my computer.
Reply With Quote
  #3   (View Single Post)  
Old 10th August 2009
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

Quote:
Originally Posted by BSDfan666 View Post
.. an extended partition is essentially a link to an additional partition table that again can have an additional 3 primary, 1 extended partition. (..this can keep going for quite a bit unfortunately.).
These partition tables inside the extended partition will generally define just one usable "logical partition", two empties and a pointer to the next one, so they form a linked list. (My desciption is a bit loose, but that's the gist of it.) The logical partitions can't be used as a primary partition for things that really need a primary partition ... there are just 3 (or 4) of those on the disk in the MBR partition table.

Quote:
OpenBSD 4.5 supports being installed on extended partitions now ...
Interesting, didn't know that or had forgotten!

Quote:
OpenBSD creates "fictitious" disklabel entries for foreign partitions it finds.. but I have not confirmed that it recurses through extended partition tables.

Can anyone comment on this? I never install more then one operating system on my computer.
Yes, I believe that it does. Today I'm running NetBSD and here is my disklabel:

Code:
16 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   5278896  10763550     4.2BSD   2048 16384     0  # (Cyl.  10678*-  15915*)
 b:    263529  16042446       swap                     # (Cyl.  15915*-  16176*)
 c:   5542425  10763550     unused      0     0        # (Cyl.  10678*-  16176*)
 d:  80418240         0     unused      0     0        # (Cyl.      0 -  79779)
 g:    273042        63 Linux Ext2      0     0        # (Cyl.      0*-    270*)
 h:  10490445    273105 Linux Ext2      0     0        # (Cyl.    270*-  10678*)
 i:    626472  16306038 Linux Ext2      0     0        # (Cyl.  16176*-  16798*)
 j:   6313482  16932573 Linux Ext2      0     0        # (Cyl.  16798*-  23061*)
 k:   5943987  23246118 Linux Ext2      0     0        # (Cyl.  23061*-  28958*)
 l:  10506447  29190168 Linux Ext2      0     0        # (Cyl.  28958*-  39381*)
 m:  20370357  39696678 Linux Ext2      0     0        # (Cyl.  39381*-  59590*)
 n:  20338227  60067098 Linux Ext2      0     0        # (Cyl.  59590*-  79767*)
ISTR that OpenBSD can do about the same.

Last edited by IdOp; 10th August 2009 at 03:16 AM. Reason: spelling
Reply With Quote
  #4   (View Single Post)  
Old 10th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Thank you for your answers:
Quote:
Please search for the "COMMAND MODE" section in that man page for more information about switching between extended table views.
I guess this is the part of the fdisk manpage you mean:
Quote:
select #
Select and load into memory the boot block pointed to by the ex-
tended MBR partition table entry in the current boot block.
but to tell the truth it looks quite cryptic to me

So, from what you are telling me, I should be able to dump OpenBSD somewhere, and then cancel its partition and turn it into an extended partition which I could split again into a partition for OpenBSD and one for my ext2 partition, or even from there create another extended partition where I could install Opensuse.
Did I get it right?
Reply With Quote
  #5   (View Single Post)  
Old 10th August 2009
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

A small update: here is the disklabel for the same disk as above, but as provided by OpenBSD:
Code:
16 partitions:
#                size           offset  fstype [fsize bsize  cpg]
  c:         80418240                0  unused                   
  i:           273042               63  ext2fs                   
  j:         10490445           273105  ext2fs                   
  k:          5542425         10763550 unknown                   
  l:           626472         16306038  ext2fs                   
  m:          6313482         16932573  ext2fs                   
  n:          5943987         23246118  ext2fs                   
  o:         10506447         29190168  ext2fs                   
  p:         20370357         39696678  ext2fs
(I'm pretty sure this one is the default; the NetBSD one may have been edited a bit ... not sure anymore.)
Reply With Quote
  #6   (View Single Post)  
Old 10th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

I've just tried to play with fdisk on an old usb stick, and I start to understand how it works.
For the extended partition I should choose "Extended LBA" (id 0F), right?
Reply With Quote
  #7   (View Single Post)  
Old 10th August 2009
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

Quote:
Originally Posted by gosha View Post
For the extended partition I should choose "Extended LBA" (id 0F), right?
0F is W95 Ext'd (LBA) ... I think you want type 05.

ADDED: Hmmm, it seems 0x05, 0x0F and 0x85 are all used for this.

EDIT2: Thanks BSDfan666, I added the above after seeing the original version of your post. I've always gotten away with 05, but maybe there are circumstances where the other is better, so it's good to know about.

Last edited by IdOp; 10th August 2009 at 02:42 PM.
Reply With Quote
  #8   (View Single Post)  
Old 10th August 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

Quote:
Originally Posted by gosha View Post
I've just tried to play with fdisk on an old usb stick, and I start to understand how it works.
For the extended partition I should choose "Extended LBA" (id 0F), right?
That appears to be the agreed upon value, you can use to "setpid" command to change the type of your existing OpenBSD partition.

EDIT: @IdOp: That may be wrong, OpenBSD calls 0x05 "Extended DOS" and 0x0F "Extended LBA", considering LBA is the modern way of addressing disks.. this may be the preferred partition type marker.

EDIT2: OpenBSD appears to treat both values identically, so it doesn't matter.. it always checks for DOSPTYP_EXTEND and DOSPTYP_EXTENDL which are defined as 0x05 and 0x0F in /usr/include/sys/disklabel.h.

EDIT3: OpenBSD does not support an extended partition type id of 0x85, (Linux extended).

Last edited by BSDfan666; 10th August 2009 at 02:44 PM.
Reply With Quote
  #9   (View Single Post)  
Old 10th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,033
Default

I have never been able to get the bootloader to run from an extended partition, but I've only ever tested it under Qemu. I flag the extended partition, then flag the A6 partition in the extended MBR. I get:
Quote:
Using drive 0, partition 3
Using drive 0, partition 0
No O/S
What I did learn, though, was that the extended MBR needs both a proper signature and MBR boot code (installed with the fdisk "update" command), and, that the first track (e.g. 63 sectors) should be reserved to prevent overlay, just as with the primary MBR.
Reply With Quote
Old 10th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Quote:
That appears to be the agreed upon value, you can use to "setpid" command to change the type of your existing OpenBSD partition.
It means it will not touch the existing installation, no need to dump/restore, right?
Reply With Quote
Old 10th August 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

No, you'll have to recreate the OpenBSD partition within the extended partition table.. offsets will most likely be different, so you'll need to reinstall.
Reply With Quote
Old 10th August 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

I managed to install OpenBSD 4.5 in QEMU on an extended partition, unfortunately as jggimi mentioned.. the bootloader is unable to boot.

This is my mistake, I do apologize.. perhaps full support is in 4.6/-CURRENT but it is clearly not available in 4.5.
Reply With Quote
Old 10th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,033
Default

I just tested under Qemu, again. I could get the bootloader to operate, if I booted it from GAG.

Any bootloader (GAG, Grub, Lilo, perhaps even Windows' boot.ini.) should work.
Reply With Quote
Old 10th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Ok, thank you all, I'll give it a try today, maybe Vista's bootloader will work
Reply With Quote
Old 11th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

I've tried and I thought my partitions were all ok, but now there seems to be something lost. The machines says there's no valid operating system. Gparted also shows an empty hard disk, but this is fdisk run from an OpenBSD I installed on a usb stick:
Code:
# fdisk -e sd0
Enter 'help' for information
fdisk: 1> p g
Disk: sd0       geometry: 32301/240/63 [233 Gigabytes]
Offset: 0       Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 07      0  32  33 -    203  74  26 [        2048:           1G] HPFS/QNX/AUX
 1: 07    203  74  27 -   7137 239  63 [     3074048:          50G] HPFS/QNX/AUX
 2: 07  30946 178  19 -  32301  57  41 [   467914752:          10G] HPFS/QNX/AUX
 3: 0F   7138   0   1 -  30945 239  63 [   107926560:         172G] Extended LBA
fdisk: 1> select 3
Selected extended partition 3
New MBR at offset 107926560.
Enter 'help' for information
fdisk: 2> p g
Disk: sd0       geometry: 32301/240/63 [233 Gigabytes]
Offset: 107926560       Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: A6   7138   0   1 -  14073 239  63 [   107926560:          50G] OpenBSD     
 1: 83  14074   0   1 -  16154 239  63 [   212798880:          15G] Linux files*
 2: 82  16155   0   1 -  16849 239  63 [   244263600:           5G] Linux swap  
 3: 83  16850   0   1 -  30945 239  63 [   254772000:         102G] Linux files*
So what have I done? Why did Vista also disappear?
Reply With Quote
Old 11th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,033
Default

I don't know what you've done. From what you've posted:

  • There is no flagged partition in your root MBR for your BIOS to boot.
  • You appear to have a valid MBR signature in your extended MBR.
  • Your OpenBSD partition begins at the same track as your extended MBR, and if you install it there, you will destroy the extended MBR. Change the starting position of the OpenBSD partition to 7138/1/1 to move it 63 sectors ahead.
  • None of your extended partitions are flagged bootable, either. But, as discussed above, our testing (in a virtual machine) indicate that flagging both the "root" extended partition and the OpenBSD partition will fail to have OpenBSD boot directly from BIOS anyway.
Reply With Quote
Old 11th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

Thanks jggimi,
I changed the partition starting and now it seems fine, but still cannot find OpenBSD, or, the Vista bootloader does not show the extended partition as an option. I installed EasyBCD which gives the option to install NeoGrub, which I guess should solve the problem but I can't figure out how to tell NeoGrub to find the first partition of the extended partition. All examples I've found are about primary partitions inside mbr. So do you know how the entry in the configuration should be?
"hd0,X" what should the number be?
Reply With Quote
Old 11th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,033
Default

I don't know Grub or Lilo, I only use them when I absolutely have to (such as when running Linux). I would guess that Grub would assign partition #5, but it is only a guess. My bootloader of choice for multiboot systems is GAG.
Reply With Quote
Old 11th August 2009
gosha gosha is offline
Spam Deminer
 
Join Date: Jun 2008
Location: China
Posts: 256
Default

I've tried (hd0,5,a) but it gives error 22 saying I should use a Vista compatible fdisk to partition the hd
How do I install gag without a floppy and without a cdrom?


Added:
Presently partition tables look like this:
Code:
Disk: sd0	geometry: 32301/240/63 [488397168 Sectors]
Offset: 0	Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*0: 07      0  32  33 -    203  74  26 [        2048:     3072000 ] HPFS/QNX/AUX
 1: 07    203  74  27 -   7137 239  63 [     3074048:   104852512 ] HPFS/QNX/AUX
 2: 07  30946 178  19 -  32301  57  41 [   467914752:    20480000 ] HPFS/QNX/AUX
 3: 0F   7138   1  63 -  30945 239  63 [   107926685:   359976835 ] Extended LBA
Offset: 107926685	Signature: 0x0
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: A6   7138   2   1 -  14072 239  63 [   107926686:   104857074 ] OpenBSD     
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: 00      0   0   0 -      0   0   0 [           0:           0 ] unused

Last edited by gosha; 11th August 2009 at 11:31 AM.
Reply With Quote
Old 11th August 2009
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,033
Default

Quote:
...How do I install gag without a floppy and without a cdrom?
Download GAG.
Unzip the archive.
Open the docs/index.html file in your browser.
Click on the How to install GAG link.
Read and follow the DIRECT INSTALLATION section. You'll need a running Linux system.


Alternatively, remove your hard drive and insert it in a system with a diskette or CD/DVD drive. Or, do the installation from a virtual machine with a virtual floppy / CD drive, and that has been given physical access to the entire hard drive.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Operating BSD partitions through XP SunSpyda OpenBSD General 10 16th September 2009 08:22 PM
How to swap partitions Help revzalot OpenBSD Installation and Upgrading 2 1st September 2009 07:44 AM
backup fdisk partitions gosha OpenBSD General 17 16th July 2009 03:19 AM
Moving ZFS partitions/drives between systems corey_james Guides 2 6th August 2008 08:36 PM
partitions italogf FreeBSD Installation and Upgrading 5 7th July 2008 12:14 PM


All times are GMT. The time now is 11:10 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick