Hitchhiker's Guide to Openbsd


disklabel(8) during OpenBSD's install


Download 1.27 Mb.
Pdf ko'rish
bet208/258
Sana04.04.2023
Hajmi1.27 Mb.
#1328980
1   ...   204   205   206   207   208   209   210   211   ...   258
Bog'liq
obsd-faq49

disklabel(8) during OpenBSD's install
One of the major parts of OpenBSD's install is your initial creation of labels. During the install you use disklabel
(8) to create your separate partitions. As part of the install process, you can define your mount points from within 
disklabel(8), but you can change these later in the install or post-install, as well. 
There is not one "right" way to label a disk, but there are many wrong ways. Before attempting to label your disk
see 
this discussion
 on partitioning and partition sizing. 
For an example of using disklabel(8) during install, see the 
Setting up disks
 part of the 
Installation Guide

Using disklabel(8) after install
After install, one of the most common reasons to use disklabel(8) is to look at how your disk is laid out. The 
following command will show you the current disklabel, without modifying it: 
disklabel wd0 <-- Or whatever disk device you'd like to view
type: ESDI
disk: ESDI/IDE disk
label: SAMSUNG HD154UI 
uid: d920a43a5a56ad5f
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 2907021
total sectors: 2930277168
boundstart: 64
boundend: 2930272065
drivedata: 0 
16 partitions:
# size offset fstype [fsize bsize cpg]
a: 1024064 64 4.2BSD 2048 16384 1 
# /
b: 4195296 1024128 swap
c: 2930277168 0 unused
d: 4195296 5219424 4.2BSD 2048 16384 1 
# /usr
e: 4195296 9414720 4.2BSD 2048 16384 1 
http://www.openbsd.org/faq/faq14.html (6 of 34)9/4/2011 10:02:25 AM


14 - Disk Setup
# /tmp
f: 20972448 13610016 4.2BSD 2048 16384 1 
# /var
h: 2097632 34582464 4.2BSD 2048 16384 1 
# /home
Note how this disk has only part of its disk space allocated at this time. Disklabel offers two different modes for 
editing the disklabel, a built-in command-driven editor (this is how you installed OpenBSD originally), and a full 
editor, such as 
vi(1)
. You may find the command-driven editor "easier", as it guides you through all the steps and 
provides help upon request, but the full-screen editor has definite use, too. 
Let's add a partition to the above system. 
Warning: Any time you are fiddling with your disklabel, you are putting all the data on your disk at 
risk. Make sure your data is backed up before editing an existing disklabel! 
We will use the built-in command-driven editor, which is invoked using the "-E" option to disklabel(8). 
disklabel -E wd0
...
> a k
offset: [36680096] 
size: [2893591969] 1T
Rounding to cylinder: 2147483536
FS type: [4.2BSD] 
> p m
OpenBSD area: 64-2930272065; size: 1430796.9M; free: 364310.8M
# size offset fstype [fsize bsize cpg]
a: 500.0M 64 4.2BSD 2048 16384 1 
# /
b: 2048.5M 1024128 swap
c: 1430799.4M 0 unused
d: 2048.5M 5219424 4.2BSD 2048 16384 1 
# /usr
e: 2048.5M 9414720 4.2BSD 2048 16384 1 
# /tmp
f: 10240.5M 13610016 4.2BSD 2048 16384 1 
# /var
h: 1024.2M 34582464 4.2BSD 2048 16384 1 
# /home
k: 1048575.9M 36680192 4.2BSD 8192 65536 1 
> q
Write new label?: [y] 
In this case, disklabel(8) was kind enough to calculate a good starting offset for the partition. In many cases, it 
will be able to do this, but if you have "holes" in the disklabel (i.e., you deleted a partition, or you just like making 
http://www.openbsd.org/faq/faq14.html (7 of 34)9/4/2011 10:02:25 AM


14 - Disk Setup
your life miserable) you may need to sit down with a paper and pencil to calculate the proper offset. Note that 
while disklabel(8) does some sanity checking, it is very possible to do things very wrong here. Be careful, 
understand the meaning of the numbers you are entering. 
On most OpenBSD platforms, there are sixteen disklabel partitions available, labeled "a" through "p". (some 
"specialty" systems may have only eight). Every disklabel should have a 'c' partition, with an "fstype" of "unused" 
that covers the entire physical drive. If your disklabel is not like this, it must be fixed, the "D" option (below) can 
help. Never try to use the "c" partition for anything other than accessing the raw sectors of the disk, do not attempt 
to create a file system on "c". On the boot device, "a" is reserved for the root partition, and "b" is the swap 
partition, but only the boot device makes these distinctions. Other devices may use all fifteen partitions other than 
"c" for file systems. 

Download 1.27 Mb.

Do'stlaringiz bilan baham:
1   ...   204   205   206   207   208   209   210   211   ...   258




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling