« May 2008
SunMonTueWedThuFriSat
    
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
       
Today
XML

Tom Haynes

loghyr.com
excfb.com

Blogs to Gander At

Navigation

Editing

AllMarks

Referers

Today's Page Hits: 337

Powered by Roller Weblogger.

statcounter.com

clustrmaps.com

Locations of visitors to this page

technorati.com

www.alesti.org

Add to Alesti RSS Reader

South Park as I was 10 years ago

South Park Fantasy

South Park today

South Park Reality

I have more hair and it isn't so grey. :->

10 years ago, really

Toon Tom

Today, literally

Tom Today

Site notes

This page validates as XHTML 1.0, and will look much better in a browser that supports web standards, but it is accessible to any browser or Internet device. It was created using techniques detailed at glish.com/css/.

« A quick and dirty... | Main | Successful addition... »
20070121 Sunday January 21, 2007
How to determine sizing requirements for adding packages to .packagetoc files

Okay, I was looking for something internally and I accidently came across the document which told me how to determine the sizing information for when you add a package to a .packagetoc. You could argue that it should already be in a man page.

Anyway, it isn't a big secret, I think it is just something that gets taken for granted. Actually, after seeing some of the gross differences between what the document describes and what I am used to, I think this is a SunOS document. ;>

The algorithm is quite simple. First you install the target OS on a computer with separate partitions for /, /var, /usr, and /opt. Then you determine how much space is being currently used by the OS. You then add your package, determine the new space usage, and you pretty much have your numbers. You also have to watch /var/sadm/contents to help determine the maximum /var size.

Lets do it with an example and compare the results to the SWAG I made the other day in Adding a new package to an Install DVD.

We need to make sure to get filesystems for those of interest:

_ Automatically Layout File Systems ____________________________________________

  On this screen you must select all the file systems you want auto-layout to
  create, or accept the default file systems shown.

  NOTE: For small disks, it may be necessary for auto-layout to break up some
  of the file systems you request into smaller file systems to fit the
  available disk space. So, after auto-layout completes, you may find file
  systems in the layout that you did not select from the list below.

            File Systems for Auto-layout
            ========================================
            [X]  /
            [X]  /opt
            [X]  /usr
            [ ]  /usr/openwin
            [X]  /var
            [X]  swap




________________________________________________________________________________
     Esc-2_Continue    F5_Cancel    F6_Help

Here is the final layout on a scratch system:

_ File System and Disk Layout __________________________________________________

  The summary below is your current file system and disk layout, based on the
  information you've supplied.

  NOTE: If you choose to customize, you should understand file systems, their
  intended purpose on the disk, and how changing them may affect the operation
  of the system.

      File sys/Mnt point Disk/Slice                                       Size
      ========================================================================
      overlap            c0d0s2                                     19061   MB
      /export/home       c0d0s6                                     1035    MB
      /opt               c0d0s7                                     18002   MB
      /                  c1d0s0                                     15241   MB
      /var               c1d0s1                                     10244   MB
      overlap            c1d0s2                                     38138   MB
      swap               c1d0s3                                     2384    MB
      /usr               c1d0s7                                     10244   MB



________________________________________________________________________________
     Esc-2_Continue    F3_Go Back    F4_Customize    F5_Exit    F6_Help

Okay, the install is done, let's see what we have:

# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c1d0s0      15370534  304493 14912336     3%    /
/devices                   0       0       0     0%    /devices
/dev                       0       0       0     0%    /dev
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 3952312     476 3951836     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
/dev/dsk/c1d0s7      10331209 3063533 7164364    30%    /usr
/usr/lib/libc/libc_hwcap2.so.1
                     10331209 3063533 7164364    30%    /lib/libc.so.1
fd                         0       0       0     0%    /dev/fd
/dev/dsk/c1d0s1      10331209  120946 10106951     2%    /var
swap                 3951872      36 3951836     1%    /tmp
swap                 3951868      32 3951836     1%    /var/run
/dev/dsk/c0d0s7      18152978  462249 17509200     3%    /opt
/dev/dsk/c0d0s6      1027889    1057  965159     1%    /export/home

And:

# ls -la /var/sadm/contents
/var/sadm/contents: No such file or directory

Bzzt, I have my hands on an old document. Hmm, think it means this:

# cd /var/sadm
# ls -la
total 82
drwxr-xr-x  13 root     sys          512 Jan 21 12:56 .
drwxr-xr-x  42 root     sys         1024 Jan 21 13:29 ..
-r--r--r--   1 root     sys         1092 Dec 19 17:23 README
dr-xr-xr-x   4 root     bin          512 Jan 21 13:29 install
drwxr-xr-x   2 root     sys          512 Jan 21 12:53 install_data
drwxr-xr-x   2 root     root         512 Jan 21 12:54 patch
dr-xr-xr-x 1157 root     sys        27136 Jan 21 12:53 pkg
drwxr-xr-x   2 root     root         512 Jan 21 12:54 prod
dr-xr-xr-x   2 root     sys          512 Jan 21 12:31 security
drwxr-xr-x   2 root     sys          512 Jan 21 12:29 softinfo
drwxr-xr-x   3 root     sys          512 Jan 21 12:32 spool
drwxr-xr-x   2 root     sys          512 Jan 21 12:31 svm3
drwxr-xr-x   5 root     sys          512 Jan 21 12:29 system
drwxr-xr-x   5 root     sys          512 Jan 21 12:30 wbem
# find . -name contents
./install/contents
# ls -al install/contents
-rw-r--r--   1 root     root     16988435 Jan 21 13:29 install/contents
# file !$
file install/contents
install/contents:       ascii text
# head install/contents
/bin=./usr/bin s none SUNWcsr
/boot d none 0755 root sys SUNWcakr SUNWrmodr CADP160 SUNWadp SUNWcadp SYMhisl SUNWgrub
/boot/acpi d none 0755 root sys SUNWckr
/boot/acpi/tables d none 0755 root sys SUNWckr

Looking at some search results, I think so. Anyway, let's shoot for it.

# pkgadd -d . SUNWonbld

Processing package instance <SUNWonbld> from </export/home/tdh>

OS-Net Build Tools(i386) 11.11,REV=2007.01.08.23.45
Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Using </> as the package base directory.

Yada, yada, yada

## Installing part 1 of 1.
/opt/onbld/bin/Install <already present on Read Only file system>
/opt/onbld/bin/bfu <already present on Read Only file system>
/opt/onbld/bin/i386/abi_audit <already present on Read Only file system>

Whoops, this is what I get for leaving NIS on. Turn it off and restart the autofs service:

# cd /etc
# cp nsswitch.files nsswitch.conf
# svcadm restart autofs
# ls -la /opt/onbld/
total 4
dr-xr-xr-x   2 root     root         512 Jan 21 13:28 .
drwxr-xr-x  14 root     sys          512 Jan 21 13:28 ..

Check to see sizes again:

# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c1d0s0      15370534  304492 14912337     3%    /
/devices                   0       0       0     0%    /devices
/dev                       0       0       0     0%    /dev
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 3922116     476 3921640     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
/dev/dsk/c1d0s7      10331209 3063533 7164364    30%    /usr
/usr/lib/libc/libc_hwcap2.so.1
                     10331209 3063533 7164364    30%    /lib/libc.so.1
fd                         0       0       0     0%    /dev/fd
/dev/dsk/c1d0s1      10331209  121013 10106884     2%    /var
swap                 3921676      36 3921640     1%    /tmp
swap                 3921672      32 3921640     1%    /var/run
/dev/dsk/c0d0s7      18152978  462249 17509200     3%    /opt
/dev/dsk/c0d0s6      1027889   36010  930206     4%    /export/home
# ls -la /var/sadm/install/contents
-rw-r--r--   1 root     root     16996909 Jan 21 14:04 /var/sadm/install/contents
# tail /var/sadm/install/contents
/var/yp/updaters f none 0500 root bin 1393 51153 1167993853 SUNWypr
# Last modified by pkgadd for SUNWonbld package
# Sun Jan 21 14:04:27 2007

Okay, try the install again:

# pkgadd -d . SUNWonbld

Processing package instance <SUNWonbld> from </export/home/tdh>

OS-Net Build Tools(i386) 11.11,REV=2007.01.08.23.45
Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.

This appears to be an attempt to install the same architecture and
version of a package which is already installed.  This installation
will attempt to overwrite this package.


The installation of this package was previously terminated and
installation was never successfully completed.

Do you want to continue with the installation of <SUNWonbld> [y,n,?] n

Installation of <SUNWonbld> was terminated due to user request.
No changes were made to the system.

Remove it, basically from the database:

# pkgrm SUNWonbld

The following package is currently installed:
   SUNWonbld  OS-Net Build Tools
              (i386) 11.11,REV=2007.01.08.23.45

Do you want to remove this package? [y,n,?,q] y

And now, once again check the sizes:

# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c1d0s0      15370534  304492 14912337     3%    /
/devices                   0       0       0     0%    /devices
/dev                       0       0       0     0%    /dev
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 3921964     476 3921488     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
/dev/dsk/c1d0s7      10331209 3063533 7164364    30%    /usr
/usr/lib/libc/libc_hwcap2.so.1
                     10331209 3063533 7164364    30%    /lib/libc.so.1
fd                         0       0       0     0%    /dev/fd
/dev/dsk/c1d0s1      10331209  120975 10106922     2%    /var
swap                 3921524      36 3921488     1%    /tmp
swap                 3921520      32 3921488     1%    /var/run
/dev/dsk/c0d0s7      18152978  462249 17509200     3%    /opt
/dev/dsk/c0d0s6      1027889   36010  930206     4%    /export/home
# ls -la /var/sadm/install/contents
-rw-r--r--   1 root     root     16988435 Jan 21 14:17 /var/sadm/install/contents
# tail /var/sadm/install/contents
# Last modified by pkgrm for SUNWonbld package
# Sun Jan 21 14:17:55 2007

Okay, one more time:

# pkgadd -d . SUNWonbld

Processing package instance <SUNWonbld> from </export/home/tdh>

OS-Net Build Tools(i386) 11.11,REV=2007.01.08.23.45
Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Using </> as the package base directory.

yada, yada, yada

And everything is added correctly. What are the new sizes?

# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c1d0s0      15370534  304493 14912336     3%    /
/devices                   0       0       0     0%    /devices
/dev                       0       0       0     0%    /dev
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 3920952     476 3920476     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
/dev/dsk/c1d0s7      10331209 3063533 7164364    30%    /usr
/usr/lib/libc/libc_hwcap2.so.1
                     10331209 3063533 7164364    30%    /lib/libc.so.1
fd                         0       0       0     0%    /dev/fd
/dev/dsk/c1d0s1      10331209  121011 10106886     2%    /var
swap                 3920512      36 3920476     1%    /tmp
swap                 3920508      32 3920476     1%    /var/run
/dev/dsk/c0d0s7      18152978  479716 17491733     3%    /opt
/dev/dsk/c0d0s6      1027889   36010  930206     4%    /export/home
# ls -la /var/sadm/install/contents
-rw-r--r--   1 root     root     16996800 Jan 21 14:20 /var/sadm/install/contents

So, here are the values I did a SWAG in Adding a new package to an Install DVD:

ROOTSIZE=17500000
VARSIZE=0
OPTSIZE=17500000
EXPORTSIZE=0
USRSIZE=0
USROWNSIZE=0
SPOOLEDSIZE=17500000

The first thing to note is that I guessed the values were in bytes, I'm wrong. These should be in kilobytes. Ouch, already way off.

And here are the values I calculate from above:

ROOTSIZE=1
VARSIZE=36
OPTSIZE=17467
EXPORTSIZE=0
USRSIZE=0
USROWNSIZE=0
SPOOLEDSIZE=17467

Now, I also need to account for /var the size of the database. I'm going to use the very first size since I think that is more realistic.

16996800 - 16988435 = 8365

This value is in bytes, so it needs to become 9. Be generous when rounding. The guidelines also stated to double it when adding it to VARSIZE. This last fudge factor is to allow for any overhead during installation.

The final fudge factor is to multiply your numbers by 10-15%. If we add it all up, we get:

ROOTSIZE=2
VARSIZE=63
OPTSIZE=20088
EXPORTSIZE=0
USRSIZE=0
USROWNSIZE=0
SPOOLEDSIZE=20088

Now, even with this generous padding, how far off was I? The good news was not much. The bad news was that the unit mismatch meant that I was requesting about 16G in the root - perhaps 48G depending on the way my partitions fell. And I also needed that much RAM to do the install.

Anyway, I'll respin the DVD soon and see how it goes with the new sizes.


Originally posted on Kool Aid Served Daily
Copyright (C) 2007, Kool Aid Served Daily

Trackback URL: http://blogs.sun.com/tdh/entry/how_to_determine_sizing_requirements
Comments:

"First you install the target OS on a computer with separate partitions for /, /var, /usr, and /opt.".

This sounds like a job for a "whole-root" zone (if you've got the disk space). Putting it in a ZFS pool would make for easy cloning, but hard (as of now) upgrading.

Another alternative would be a live-upgrade BE (again, if you've got the disk space & slices).

The next step would be to automate/script the entire pkgadd/parse/pkgrm process.

Good stuff!

Posted by David on January 21, 2007 at 05:49 PM CST #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed
Copyright (C) 2007, Kool Aid Served Daily