|
Introduction
|
|
Note By the way, this article is published under the WTFPL. |
|
Linux -
running fdisk before OpenBSD installation:
Debian "Sarge" had been installed in "blissful ignorance" mode, as if it were the only OS ever contemplated for the machine. This meant allowing grub 0.95 to have free rein with the disc, it accordingly installed itself in the master boot record. But I did leave space for OpenBSD, by creating an "unused" fdisk partition during the installation. We now fdisk to mark the previously emptied partition for OpenBSD. The partition to be marked is the third, called "3" in Linux, but "2" in OpenBSD bildad:~# fdisk /dev/hda This is the way it looked after Debian installation Command (m for help): p Disk /dev/hda: 4000 MB, 4000776192 bytes 255 heads, 63 sectors/track, 486 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 1 122 979933+ 83 Linux /dev/hda2 123 153 249007+ 82 Linux swap / Solaris /dev/hda3 154 486 2674822+ 83 Linux Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): t Partition number (1-4): 3 Hex code (type L to list codes): A6 Changed system type of partition 3 to a6 (OpenBSD) Command (m for help): p Disk /dev/hda: 4000 MB, 4000776192 bytes 255 heads, 63 sectors/track, 486 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 1 122 979933+ 83 Linux /dev/hda2 123 153 249007+ 82 Linux swap / Solaris /dev/hda3 154 486 2674822+ a6 OpenBSD Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Typical Linux bug. Ignore it: WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks. At this point, the system is ready to install OpenBSD (I think). Notice that no partition has been marked bootable. Perhaps this will matter. Actually, I mark it bootable during installation. putting in OpenBSD 4.0 boot CD and rebooting |
| OpenBSD
installation bildad:~# shutdown -r now Broadcast message from root (ttyS0) (Sat Apr 28 23:04:37 2007): The system is going down for reboot NOW! bildad:~# Hello, kitty... >> OpenBSD/i386 CDBOOT 1.04 boot> boot booting cd0a:/4.0/i386/bsd.rd: entry point at 0x200120 Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. All rights reserved. Copyright (c) 1995-2006 OpenBSD. All rights reserved. http://www.OpenBSD.org OpenBSD 4.0 (RAMDISK_CD) #39: Sat Sep 16 19:34:26 MDT 2006 deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/RAMDISK_CD cpu0: Intel Pentium II ("GenuineIntel" 686-class, 512KB L2 cache) 266 MHz cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,MMX real mem = 100233216 (97884K) avail mem = 85016576 (83024K) using 1249 buffers containing 5115904 bytes (4996K) of memory mainbus0 (root) bios0 at mainbus0: AT/286+(00) BIOS, date 04/30/97, BIOS32 rev. 0 @ 0xfd900 pcibios0 at bios0: rev 2.1 @ 0xf0000/0x10000 pcibios0: PCI BIOS has 6 Interrupt Routing table entries pcibios0: PCI Interrupt Router at 000:07:0 ("Intel 82371SB ISA" rev 0x00) pcibios0: PCI bus #0 is the last bus bios0: ROM list: 0xc0000/0x8000 0xe9000/0x1000! 0xea000/0x2000 cpu0 at mainbus0 pci0 at mainbus0 bus 0: configuration mode 1 (bios) pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02 pcib0 at pci0 dev 7 function 0 "Intel 82371SB ISA" rev 0x01 pciide0 at pci0 dev 7 function 1 "Intel 82371SB IDE" rev 0x00: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility wd0 at pciide0 channel 0 drive 0: <WDC AC34000L> wd0: 16-sector PIO, LBA, 3815MB, 7814016 sectors wd0(pciide0:0:0): using PIO mode 4, DMA mode 2 atapiscsi0 at pciide0 channel 1 drive 0 scsibus0 at atapiscsi0: 2 targets cd0 at scsibus0 targ 0 lun 0: <, CD-R/RW RW7063A, 1.50> SCSI0 5/cdrom removable atapiscsi1 at pciide0 channel 1 drive 1 scsibus1 at atapiscsi1: 2 targets sd0 at scsibus1 targ 0 lun 0: <IOMEGA, ZIP 100, 23.D> SCSI0 0/direct removable sd0: drive offline cd0(pciide0:1:0): using PIO mode 4, DMA mode 2 sd0(pciide0:1:1): using PIO mode 0 uhci0 at pci0 dev 7 function 2 "Intel 82371SB USB" rev 0x01: irq 11 usb0 at uhci0: USB revision 1.0 uhub0 at usb0 uhub0: Intel UHCI root hub, rev 1.00/1.00, addr 1 uhub0: 2 ports with 2 removable, self powered vga1 at pci0 dev 11 function 0 "ATI Rage XL" rev 0x65 wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation) ne3 at pci0 dev 17 function 0 "Realtek 8029" rev 0x00: irq 9, address 00:50:ba:52:65:ce isa0 at pcib0 isadma0 at isa0 pckbc0 at isa0 port 0x60/5 pckbd0 at pckbc0 (kbd slot) pckbc0: using irq 1 for kbd slot wskbd0 at pckbd0: console keyboard, using wsdisplay0 npx0 at isa0 port 0xf0/16: using exception 16 pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo pccom0: console pccom1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo fdc0 at isa0 port 0x3f0/6 irq 6 drq 2 fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec isapnp0 at isa0 port 0x279: read port 0x203 "SYM 53C416 , SLI4163, , " at isapnp0 port 0x200/32 irq 5 not configured "OPL3-SA3 Snd System , YMH0021, , " at isapnp0 port 0x220/16,0x530/8,0x388/8,0x330/2,0x370/2 irq 5 drq 0,1 not configured "OPL3-SA3 Snd System , YMH0022, PNPB02F, " at isapnp0 port 0x201/1 not configured pccom3 at isapnp0 "U.S. Robotics 56K FAX INT, USR3030, , " port 0x3e8/8 irq 5: ns16550a, 16 byte fifo biomask fdc5 netmask ffc5 ttymask ffc7 rd0: fixed, 3800 blocks wd0: no disk label dkcsum: wd0 matches BIOS drive 0x80 root on rd0a rootdev=0x1100 rrootdev=0x2f00 rawdev=0x2f02 erase ^?, werase ^W, kill ^U, intr ^C, status ^T (I)nstall, (U)pgrade or (S)hell? i Welcome to the OpenBSD/i386 4.0 install program. This program will help you install OpenBSD in a simple and rational way. At any prompt except password prompts you can run a shell command by typing '!foo', or escape to a shell by typing '!'. Default answers are shown in []'s and are selected by pressing RETURN. At any time you can exit this program by pressing Control-C and then RETURN, but quitting during an install can leave your system in an inconsistent state. Terminal type? [vt220] kbd(8) mapping? ('L' for list) [none] IS YOUR DATA BACKED UP? As with anything that modifies disk contents, this program can cause SIGNIFICANT data loss. It is often helpful to have the installation notes handy. For complex disk configurations, relevant disk hardware manuals and a calculator are useful. Proceed with install? [no] yes Cool! Let's get to it. |
| Disk initialization Where many are ruined, hearts are broken, tragedies develop, and rough Beasts, their hours come round at last, slouch towards Bethlehem to be born. You will now initialize the disk(s) that OpenBSD will use. To enable all available security features you should configure the disk(s) to allow the creation of separate filesystems for /, /tmp, /var, /usr, and /home. Available disks are: sd0 wd0. Note, the sd0 is an old IOmega floppy. It is not in the boot sequence, ignore it. Which one is the root disk? (or 'done') [done] wd0 Do you want to use *all* of wd0 for OpenBSD? [no] no Read next paragraph. It is what we MUST have. What it doesn't say is whether the partition must be a "primary" or if it can be a "logical" partition. You will now create a single MBR partition to contain your OpenBSD data. This partition must have an id of 'A6'; must *NOT* overlap other partitions; and must be marked as the only active partition. We have already set up the partition under Linux, but we could also do it here. Since things are OK, except for the "active partition" marking, that's all we do now: The 'manual' command describes all the fdisk commands in detail. Disk: wd0 geometry: 969/128/63 [7814016 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------ 0: 83 0 1 1 - 243 5 63 [ 63: 1959867 ] Linux files* 1: 82 243 6 1 - 304 102 63 [ 1959930: 498015 ] Linux swap 2: A6 304 103 1 - 968 25 63 [ 2457945: 5349645 ] OpenBSD 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused Enter 'help' for information fdisk: 1> help flag Flag given table entry as bootable fdisk: 1> flag 2 Partition 2 marked active. fdisk:*1> p Disk: wd0 geometry: 969/128/63 [7814016 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------ 0: 83 0 1 1 - 243 5 63 [ 63: 1959867 ] Linux files* 1: 82 243 6 1 - 304 102 63 [ 1959930: 498015 ] Linux swap *2: A6 304 103 1 - 968 25 63 [ 2457945: 5349645 ] OpenBSD 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused fdisk:*1> w Note, offset 0 in partition 2: (I think) OpenBSD nomenclature is confusing. It needs to be rationalize, and technical terms given a single meaning. Writing MBR at offset 0. wd0: no disk label fdisk: 1> q Here is the partition information you chose: Disk: wd0 geometry: 969/128/63 [7814016 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------ 0: 83 0 1 1 - 243 5 63 [ 63: 1959867 ] Linux files* 1: 82 243 6 1 - 304 102 63 [ 1959930: 498015 ] Linux swap *2: A6 304 103 1 - 968 25 63 [ 2457945: 5349645 ] OpenBSD 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused You will now create an OpenBSD disklabel inside the OpenBSD MBR partition. The disklabel defines how OpenBSD splits up the MBR partition into OpenBSD partitions in which filesystems and swap space are created. Note the following paragraph The offsets used in the disklabel are ABSOLUTE, i.e. relative to the start of the disk, NOT the start of the OpenBSD MBR partition. # Inside MBR partition 2: type A6 start 2457945 size 5349645 Treating sectors 2457945-7807590 as the OpenBSD portion of the disk. You can use the 'b' command to change this. Resist any temptation to use the 'b' command. 'b' stands for 'breakage' Initial label editor (enter '?' for help at any prompt) > > p device: /dev/rwd0c type: ESDI disk: ESDI/IDE disk label: WDC AC34000L bytes/sector: 512 sectors/track: 63 tracks/cylinder: 16 sectors/cylinder: 1008 cylinders: 7752 total sectors: 7814016 free sectors: 5349645 rpm: 3600 16 partitions: # size offset fstype [fsize bsize cpg] a: 5349645 2457945 unused 0 0 c: 7814016 0 unused 0 0 i: 1959867 63 ext2fs j: 498015 1959930 unknown That is the partition table that OpenBSD kernel deduced from inspecting the drive. This is a 4GB IDE drive, so should have about 8,000,000 sectors; it does. See the 'c' partition. It is correct. The 'i' and 'j' partitions are from Linux. 'j' is the Linux swap partition. Note that disklabel doesn't directly know about fdisk partitions. Note that disklabel partitions *can* overlap fdisk partition boundaries, and *can* overlap other disklabel partitions, both within their own disklabel, and those in a disklabel on another partition. This comes into play if another OS that uses disklabels, or another version/release/configuration of OpenBSD is installed in different fdisk partition. This disklabel is unsatisfactory as-is, I want several partitions and a swap area for OpenBSD. For simplicity, I will ignore the chance that the Linux swap partition 'j' could be useful. Note the offset of the Linux 'i' partition, 63 sectors from the start of the disk. OpenBSD partitions must avoid that area, too. That's where the bootloader lives, in this case grub 0.95. I will delete the existing 'a' partition (I might have "edited" it instead, but deleting it is simple. (I will snip the device specs in the disklabel printout.) > d a > p 16 partitions: # size offset fstype [fsize bsize cpg] c: 7814016 0 unused 0 0 i: 1959867 63 ext2fs j: 498015 1959930 unknown Now add a new a partition. Accept many defaults. You paid good money for this program, trust its judgment. > a partition: [a] offset: [2457945] size: [5349645] 256M Rounding to nearest cylinder: 523719 FS type: [4.2BSD] mount point: [none] / Add another partition > a partition: [b] offset: [2981664] size: [4825926] 256M Rounding to nearest cylinder: 524160 FS type: [swap] And one for /usr > a partition: [d] e offset: [3505824] size: [4301766] FS type: [4.2BSD] mount point: [none] /usr > p 16 partitions: # size offset fstype [fsize bsize cpg] a: 523719 2457945 4.2BSD 2048 16384 16 # / b: 524160 2981664 swap c: 7814016 0 unused 0 0 e: 4301766 3505824 4.2BSD 2048 16384 16 # /usr i: 1959867 63 ext2fs j: 498015 1959930 unknown Write it to the disk, it looks good. > w Think a little more, and quit. > q No label changes. Done with disklabel! Mount point for wd0e (size=2150883k)? (or 'none' or 'done') [/usr] done Available disks are: sd0. Which one do you wish to initialize? (or 'done') [done] OpenBSD filesystems: wd0a / wd0e /usr The next step *DESTROYS* all existing data on these partitions! Are you really sure that you're ready to proceed? [no] yes /dev/rwd0a: 523716 sectors in 520 cylinders of 16 tracks, 63 sectors 255.7MB in 2 cyl groups (328 c/g, 161.44MB/g, 20608 i/g) Warning: inode blocks/cyl group (190) >= data blocks (114) in last cylinder group. This implies 3652 sector(s) cannot be allocated. /dev/rwd0e: 4298112 sectors in 4264 cylinders of 16 tracks, 63 sectors 2098.7MB in 13 cyl groups (328 c/g, 161.44MB/g, 20608 i/g) /dev/wd0a on /mnt type ffs (rw, asynchronous, local, ctime=Sun Apr 29 03:10:29 2007) /dev/wd0e on /mnt/usr type ffs (rw, asynchronous, local, nodev, ctime=Sun Apr 29 03:10:29 2007) |
| Remainder
of Installation, disks are now done System hostname? (short form, e.g. 'foo') bildad Configure the network? [yes] Available interfaces are: ne3. Which one do you wish to initialize? (or 'done') [ne3] Symbolic (host) name for ne3? [bildad] The media options for ne3 are currently media: Ethernet autoselect (10baseT) Do you want to change the media options? [no] IPv4 address for ne3? (or 'none' or 'dhcp') 192.168.1.10 Netmask? [255.255.255.0] IPv6 address for ne3? (or 'rtsol' or 'none') [none] No more interfaces to initialize. DNS domain name? (e.g. 'bar.com') [my.domain] chuck DNS nameserver? (IP address or 'none') [none] 192.168.1.1 Use the nameserver now? [yes] Default IPv4 route? (IPv4 address, 'dhcp' or 'none') 192.168.1.1 add net default: gateway 192.168.1.1 Edit hosts with ed? [no] Do you want to do any manual network configuration? [no] Password for root account? (will not echo) Password for root account? (again) Let's install the sets! Location of sets? (cd disk ftp http or 'done') [cd] cd Available CD-ROMs are: cd0. Which one contains the install media? (or 'done') [cd0] Pathname to the sets? (or 'done') [4.0/i386] Select sets by entering a set name, a file name pattern or 'all'. De-select sets by prepending a '-' to the set name, file name pattern or 'all'. Selected sets are labelled '[X]'. [X] bsd [X] bsd.rd [ ] bsd.mp [X] base40.tgz [X] etc40.tgz [X] misc40.tgz [X] comp40.tgz [X] man40.tgz [X] game40.tgz [ ] xbase40.tgz [ ] xetc40.tgz [ ] xshare40.tgz [ ] xfont40.tgz [ ] xserv40.tgz Set name? (or 'done') [bsd.mp] done Ready to install sets? [yes] Getting bsd ... 100% |**************************************************| 5904 KB 00:03 Getting bsd.rd ... 100% |**************************************************| 4889 KB 00:02 Getting base40.tgz ... 100% |**************************************************| 40675 KB 00:50 Getting etc40.tgz ... 100% |**************************************************| 1133 KB 00:03 Getting misc40.tgz ... 100% |**************************************************| 2233 KB 00:03 Getting comp40.tgz ... 100% |**************************************************| 77933 KB 01:13 Getting man40.tgz ... 100% |**************************************************| 7427 KB 00:14 Getting game40.tgz ... 100% |**************************************************| 2548 KB 00:03 Location of sets? (cd disk ftp http or 'done') [done] Start sshd(8) by default? [yes] Start ntpd(8) by default? [no] Do you expect to run the X Window System? [no] Change the default console to com0? [no] yes Available speeds are: 9600 19200 38400 57600 115200. Which one should com0 use? (or 'done') [9600] Saving configuration files...done. Generating initial host.random file...done. What timezone are you in? ('?' for list) [Canada/Mountain] US/Eastern Setting local timezone to 'US/Eastern'...done. Making all device nodes...done. This is a critical point, the installation of the bootblocks Note, during installation the harddisc is mounted on /mnt; /mnt/boot will be /boot in the finished system. Installing boot block... boot: /mnt/boot proto: /usr/mdec/biosboot device: /dev/rwd0c /usr/mdec/biosboot: entry point 0 proto bootblock size 512 /mnt/boot is 3 blocks x 16384 bytes Here's where it skips over all the Linuxy stuffs: fs block shift 2; part offset 2457945; inode block 64, offset 808 using MBR partition 2: type 166 (0xa6) offset 2457945 (0x258159) done. Notice that the bootblocks were written into MBR partition 2, not to the "whole disk". Notice the offset of 2457945 This is the offset of the 'a' disklabel partition a: 523719 2457945 4.2BSD 2048 16384 16 # / Note also that this is the offset of the third (#2) fdisk partition: 2: A6 304 103 1 - 968 25 63 [ 2457945: 5349645 ] OpenBSD This is all as it should be CONGRATULATIONS! Your OpenBSD install has been successfully completed! To boot the new system, enter halt at the command prompt. Once the system has halted, reset the machine and boot from the disk. and that is that! When we reboot, I expect to see the grub screen, without any hint of the OpenBSD installation. This might cause panic in the uninitiated. We will then modify, under Linux, the grub menu. # halt syncing disks... done The operating system has halted. Please press any key to reboot. rebooting... |
|
The day after: Adjusting GRUB |
|
What's happened
from the OpenBSD perspective?
The
existing Linux partitions appeared magically during the OpenBSD
The
OpenBSD partitions are mountable but not writeable under |
|
END
|
|
PS: Extended partitions?? |
|
HOW TO SHARE SWAP FOR OpenBSD
+ GNU/LINUX "Success"
|