View Single Post
  #2   (View Single Post)  
Old 17th February 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default 1.3 Overriding the suggested partition lay-out

1.3 Overriding the suggested partition lay-out

Code:
The auto-allocated layout for wd0 is:
#                size           offset  fstype [fsize bsize  cpg]
  a:          1024.0M               63  4.2BSD   2048 16384    1 # /
  b:           767.5M          2097215    swap
  c:        152627.8M                0  unused
  d:          2621.6M          3669111  4.2BSD   2048 16384    1 # /tmp
  e:          4145.1M          9038175  4.2BSD   2048 16384    1 # /var
  f:          2048.0M         17527384  4.2BSD   2048 16384    1 # /usr
  g:          1024.0M         21721688  4.2BSD   2048 16384    1 # /usr/X11R6
  h:          3611.5M         23818840  4.2BSD   2048 16384    1 # /usr/local
  i:         38154.4M         78156225 unknown
  j:         19085.0M        156296385 unknown
  k:          1962.1M         31215209  4.2BSD   2048 16384    1 # /usr/src
  l:          1962.1M         35233600  4.2BSD   2048 16384    1 # /usr/obj
  m:         18996.2M         39251991  4.2BSD   2048 16384    1 # /home

Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] c Enter
Not wishing to use the proposed auto layout, we press 'c' for a '(C)custom layout'.

Code:
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.
You must provide each filesystem's mountpoint in this program.
While previously the installer asked for the mount points after the disklabel step, now it is required to to specify these during the partitioning with 'disklabel'.

Code:
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.

Label editor (enter '?' for help at any prompt)
> help Enter

Available commands:
  ? [cmd]  - show help                  n [part] - set mount point
  A        - auto partition all space   p [unit] - print partitions
  a [part] - add partition              q        - quit & save changes
  b        - set OpenBSD boundaries     s [path] - save label to file
  c [part] - change partition size      r        - display free space
  D        - reset label to default     U        - undo all changes
  d [part] - delete partition           u        - undo last change
  e        - edit drive parameters      w        - write label to disk
  g [d|u]  - [d]isk or [u]ser geometry  X        - toggle expert mode
  l [unit] - print disk label header    x        - exit & lose changes
  M        - disklabel(8) man page      z        - delete all partitions
  m [part] - modify partition

Suffixes can be used to indicate units other than sectors:
        'b' (bytes), 'k' (kilobytes), 'm' (megabytes), 'g' (gigabytes)
        'c' (cylinders), '%' (% of total disk), '&' (% of free space).
Values in non-sector units are truncated to the nearest cylinder boundary.
The shortest command to set the mount point is 'n'. If besides the mount point, you want to modify the file system type as well, the 'm' is the way to go.

If you happen to have a very simple layout with for example only one single 'a' partition for '/' and a swap partition, it is easy to set the mount point. In case of a complex one, having the output of the 'mount' available is a life saver. In my case I had mailed the information to my Gmail account.

Code:
to	x.y.z@gmail.com
date	Sun, Jan 17, 2010 at 11:25 PM
subject	vintrax disk layout

Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/wd0a     61.4M   32.0M   26.3M    55%    /
/dev/wd0m      6.5G    2.8G    3.4G    44%    /backup
/dev/wd0e     19.7G    2.8G   15.9G    15%    /home/j65nko
/dev/wd0d      502M    2.0K    477M     0%    /tmp
/dev/wd0k      3.9G    418M    3.3G    11%    /usr
/dev/wd0l      3.9G    210K    3.7G     0%    /usr/local
/dev/wd0f     1005M    3.0M    952M     0%    /var
/dev/wd0h      502M    122K    477M     0%    /var/log
/dev/wd0g      502M    4.0K    477M     0%    /var/tmp
Because the output of mount is sorted by mount point, I pasted the mount info in a 'tmp' file and sorted on the first field, the device label.

Code:
$ sort < tmp
/dev/wd0a     61.4M   32.0M   26.3M    55%    /
/dev/wd0d      502M    2.0K    477M     0%    /tmp
/dev/wd0e     19.7G    2.8G   15.9G    15%    /home/j65nko
/dev/wd0f     1005M    3.0M    952M     0%    /var
/dev/wd0g      502M    4.0K    477M     0%    /var/tmp
/dev/wd0h      502M    122K    477M     0%    /var/log
/dev/wd0k      3.9G    418M    3.3G    11%    /usr
/dev/wd0l      3.9G    210K    3.7G     0%    /usr/local
/dev/wd0m      6.5G    2.8G    3.4G    44%    /backup
Having the necessary info we can proceed with setting the mount points with the 'n' command. But first we print the partitions with the p command.

Code:
> p
OpenBSD area: 63-78156225; size: 78156162; free: 0
#                size           offset  fstype [fsize bsize  cpg]
  a:           128000           128063  4.2BSD   2048 16384    1
  b:           128000               63    swap
  c:        312581808                0  unused
  d:          1049297           256063  4.2BSD   2048 16384    1
  e:         41943888          1305360  4.2BSD   2048 16384    1
  f:          2097648         43249248  4.2BSD   2048 16384    1
  g:          1049328         45346896  4.2BSD   2048 16384    1
  h:          1049328         46396224  4.2BSD   2048 16384    1
  k:          8389584         47445552  4.2BSD   2048 16384    1
  l:          8389584         55835136  4.2BSD   2048 16384    1
  m:         13931505         64224720  4.2BSD   2048 16384    1

> n a Enter
mount point: [none] / Enter
> n d Enter
mount point: [none] /tmp Enter
> n e  Enter
mount point: [none] /home/xxx Enter
> n f Enter
mount point: [none] /var Enter
> n g Enter
mount point: [none] /var/tmp Enter
> n h Enter
mount point: [none] /var/log  Enter
> n k Enter
mount point: [none] /usr  Enter
> n l Enter
mount point: [none] /usr/local  Enter
> n m Enter
mount point: [none] /home Enter
You can prevent a partition from being formatted. for example your home partition, if you do not specify the mount point here. But as stated in Murphy's Law, mistakes are easily made, so having a backup is always recommended. Remember that you need at least to specify the "/" mount point for the "a" partition.

After setting the mount points we check our work by printing the partitions. As usual, saving is done with the q command.

Code:
> p
OpenBSD area: 63-78156225; size: 78156162; free: 0
#                size           offset  fstype [fsize bsize  cpg]
  a:           128000           128063  4.2BSD   2048 16384    1 # /
  b:           128000               63    swap
  c:        312581808                0  unused
  d:          1049297           256063  4.2BSD   2048 16384    1 # /tmp
  e:         41943888          1305360  4.2BSD   2048 16384    1 # /home/xxx
  f:          2097648         43249248  4.2BSD   2048 16384    1 # /var
  g:          1049328         45346896  4.2BSD   2048 16384    1 # /var/tmp
  h:          1049328         46396224  4.2BSD   2048 16384    1 # /var/log
  k:          8389584         47445552  4.2BSD   2048 16384    1 # /usr
  l:          8389584         55835136  4.2BSD   2048 16384    1 # /usr/local
  m:         13931505         64224720  4.2BSD   2048 16384    1 # /home
> q Enter
No label changes.
Notice the mount points nicely printed as comment at the end of each partition. Without asking any kind of confirmation, the installer now creates the files systems for the partitions for which a mount point has been created.

Code:
/dev/rwd0a: 62.5MB in 128000 sectors of 512 bytes
4 cylinder groups of 15.62MB, 1000 blocks, 2048 inodes each
/dev/rwd0m: 6802.5MB in 13931504 sectors of 512 bytes
34 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd0e: 20480.4MB in 41943888 sectors of 512 bytes
102 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
newfs: reduced number of fragments per cylinder group from 65576 to 65312
       to enlarge last cylinder group
/dev/rwd0d: 512.4MB in 1049296 sectors of 512 bytes
5 cylinder groups of 127.56MB, 8164 blocks, 16384 inodes each
/dev/rwd0k: 4096.5MB in 8389584 sectors of 512 bytes
21 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd0l: 4096.5MB in 8389584 sectors of 512 bytes
21 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd0f: 1024.2MB in 2097648 sectors of 512 bytes
6 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
newfs: reduced number of fragments per cylinder group from 65576 to 65320
       to enlarge last cylinder group
/dev/rwd0h: 512.4MB in 1049328 sectors of 512 bytes
5 cylinder groups of 127.58MB, 8165 blocks, 16384 inodes each
newfs: reduced number of fragments per cylinder group from 65576 to 65320
       to enlarge last cylinder group
/dev/rwd0g: 512.4MB in 1049328 sectors of 512 bytes
5 cylinder groups of 127.58MB, 8165 blocks, 16384 inodes each
After finishing, the installer shows the labelled partitions, the mount point, the file system type and the automatically chosen mount options.

Code:
/dev/wd0a on /mnt type ffs (rw, asynchronous, local)
/dev/wd0m on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/wd0e on /mnt/home/xxx type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/wd0d on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/wd0k on /mnt/usr type ffs (rw, asynchronous, local, nodev)
/dev/wd0l on /mnt/usr/local type ffs (rw, asynchronous, local, nodev)
/dev/wd0f on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/wd0h on /mnt/var/log type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/wd0g on /mnt/var/tmp type ffs (rw, asynchronous, local, nodev, nosuid)
The experienced user will notice that this actually is the output of the regular 'mount' command. The next step will be locating and installing the file sets.

Code:
Let's install the sets!
But as we have seen what needs to be done, we stop here.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote