www.openbsd.org/faq/faq14.html#14.5
Disklabels are created to allow an efficient interface between your disk and the disk drivers contained within the kernel. Labels hold certain information about your disk, like your drive geometry and information about your filesystems. This is then used by the bootstrap program to load the drive and to know where filesystems are contained on the drive. Labels are also used in conjunction with the filesystems to create a more efficient environment. You can read more in-depth information about disklabel by reading the 19 disklabel man page. As an additional gain, using disklabel helps overcome architecture limitations on disk partitioning. For example, on i386, you can only have 4 primary partitions. And you still have 3 more partitions available for other OSs! This comes (for i386 users) directly after using 21 fdisk. During the install you use disklabel to create your separate labels which will contain your separate mountpoints. During the install, you can set your mountpoints from within 22 disklabel, but this isn't completely necessary considering you will be prompted later to confirm you choices. But it does make your install go just a little smoother. Since this is during the install you won't have any existing labels, and they will need to be created. You can see recommended partitions that should be created and their sizes by reading 23 FAQ 4, Space Needed. For servers it is recommended that you create at least these label's separately. For desktop users creating one mountpoint at / will probably suffice. When initially creating your root partition ( 'a' label ), keep in mind that you will need SOME space left for your swap label. Now that the basics have been explained, here is an example of using disklabel during an install. In this first example it is assumed that OpenBSD will be the only operating system on this computer, and that a full install will be done. If this disk is shared with other operating systems, those operating systems should have a BIOS partition entry that spans the space they occupy completely. For safety, also make sure all OpenBSD file systems are within the offset and size specified in the 'A6' BIOS partition table. If you are unsure of how to use multiple partitions properly (ie. When it comes to the size, disklabel will show your size in sectors, however, you don't need to enter sizes in the same format. Like the example above you can enter sizes in the manner of 64 Megabytes = 64M and 2 Gigabytes = 2G. In the example above you will also notice that disklabel assumes that label 'b' will be a swap. This is a correct assumption as the GENERIC kernel is set to look for swap on label 'b', and you should just follow this guideline and use 'b' as your swap area. The next example will take you through the creation of two more labels. This means that it's not a complete install, as the size of these won't be enough to install OpenBSD to its fullest. Showing the creation of all the partitions would just be repetitive. One being that the offset is automatically figured out for you to be the next in order. When doing an install of this sort, you won't need to mess with changing the offsets at all. Another difference you might notice will be that label 'c' has been skipped. This is done for a reason, which is that label 'c' is a label that represents the whole disk. For this reason you shouldn't deal with label 'c' in any way. Once all your labels have been created all that's left to do is write the labels to disk, and move on in the installation process. To write everything and quit disklabel (and continue with the install) do: > w > q Common uses for disklabel Once your system is installed, you shouldn't need to use disklabel too often. But some times you will need to use disklabel when adding, removing or restructuring your disks. One of the first things you will need to do is view your current disklabel. This will give you a list of possible options pertaining to disklabel. You can even view the entire 24 disklabel man page with the 'M' command. From this prompt, you will do all of your adding, deleting and changing of partitions. For additional information read the 25 disklabel man page. Fdisk is a program to help with the maintenance of your partitions. This program will usually be used in Single User Mode ( boot -s ). For installation purposes, most times you'll only need ONE OpenBSD partition, and then using disklabel to put a swap and a filesystem on it. To just view your partition table using fdisk, use: # fdisk sd0 Which will give an output similar to this: Disk: sd0 geometry: 553/255/63 8883945 Sectors Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S start: size ------------------------------------------------------------------------ *0: A6 3 0 1 - 552 254 63 48195: 8835750 OpenBSD 1: 12 0 1 1 - 2 254 63 63: 48132 Compaq Diag. The * tells us that the OpenBSD partition is a bootable partition. This will bring up a command line prompt to interact with fdisk. Here is an overview of the commands you can use when you choose the -e flag. This command is particularly useful for reassigning an existing partition to OpenBSD. You may edit either in BIOS geometry mode, or in sector offsets and sizes. If you wish to boot from an extended partition, you will need to mark the partition table entry for the extended partition as bootable. In the below example we're adding a third SCSI drive to the system. Three gigabytes in disk manufacturer terms is 3000 megabytes. The offset for your first new partition should be the same as the "sectors/track" reported earlier in disklabel's output. There, you can just use "96M" to specify "96 megabytes". To get around this limitation, type 'g d' for 'geometry disk'. Finally, you need to create the filesystem on that disk using 30 newfs. You should mount the new drive in /mnt and use cpio -pdum to copy /usr/local to the /mnt directory. Swapping to a file is easiest and quickest way to get extra swap space setup. The file must not reside on a filesystem which has SoftUpdates enabled (they are disabled by default). To start out, you can see how much swap you currently have and how much you are using with the 36 swapctl utility. You can do this by using the command: $ swapctl -l Device 512-blocks Used Avail Capacity Priority swap_device 65520 8 65512 0% 0 This shows the devices currently being used for swapping and their current statistics. In the above example there is only one device named "swap_device". This is the predefined area on disk that is used for swapping. But for the purposes of this document, we will act as if an extra 32M is needed. The first step to setting up a file as a swap device is to create the file. Here is an example of creating the file /var/swap that is 32M large. Use the following command to turn on swapping to this device $ sudo chmod 600 /var/swap $ sudo swapctl -a /var/swap Now we need to check to see if it has been correctly added to the list of our swap devices. If this line is not added, your won't have this swap device configured. To swap to a file permanently, first make a kernel with vnd0c as swap. If you have wd0a as root filesystem, wd0b is the previous swap, use this line in the kernel configuration file (refer to compiling a new kernel if in doubt): config bsd root on wd0a swap on wd0b and vnd0c dumps on wd0b After this is done, the file which will be used for swapping needs to be created. You should do this by using the same command as in the above examples. Here is a sample line to boot with this device as swap on boot. Once this has been done it's time to configure the device as swap. We will do this just like in the above examples, using swapctl. Then we will check to see if it was correctly added to our list of swap devices. SoftUpdates imposes a partial ordering on the buffer cache operations which permits the requirement for synchronous writing of directory entries to be removed from the FFS code. Thus, a large performance increase is seen in disk writing performance. The potential of background fsck, using Soft Updates is not yet realised in OpenBSD, so 41 fsck is still required after an unclean shutdown. To u...
|