Adding Diskspace

Sooner or later, you will most likely run out of disk space and you will want to extend the disk, either by adding a physical disk or by adding more disk space to a VMware installation. Both are fairly easy to deal with.

When the disk gets added, it will show up in the server as either sdN (SCSI) or wdN (IDE) where N is the disk number where the first disk is 0, then 1, then 2, and so on. Please type the following on the command line to see all physically installed disks

egrep "^(sd|wd)[0-9]+\:" /var/run/dmesg.boot

which will display an output like the following

wd0: 64-sector PIO, LBA, 8192MB, 16777216 sectors
wd1: 64-sector PIO, LBA, 20480MB, 41943040 sectors
sd0: 20480MB, 2610 cyl, 255 head, 63 sec, 512 bytes/sec, 41943040 sec total

On this system, there's three disks. Two IDE disks (wd0 and wd1) and one SCSI disk (sd0).

The system is installed on wd0, lets use sd0 as the new data disk.

Formatting the new disk

Format the disk with

newfs /dev/rsd0c

Which will display something like this

/dev/rsd0c: 20480.0MB in 41943040 sectors of 512 bytes
102 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
super-block backups (for fsck -b #) at:
 32, 414688, 829344, 1244000, 1658656, 2073312, 2487968, 2902624, 3317280, 3731936, 4146592,
 4561248, 4975904, 5390560, 5805216, 6219872, 6634528, 7049184, 7463840, 7878496, 8293152, 8707808,
 9122464, 9537120, 9951776, 10366432, 10781088, 11195744, 11610400, 12025056, 12439712, 12854368,
 13269024, 13683680, 14098336, 14512992, 14927648, 15342304, 15756960, 16171616, 16586272,
 17000928, 17415584, 17830240, 18244896, 18659552, 19074208, 19488864, 19903520, 20318176,
 20732832, 21147488, 21562144, 21976800, 22391456, 22806112, 23220768, 23635424, 24050080,
 24464736, 24879392, 25294048, 25708704, 26123360, 26538016, 26952672, 27367328, 27781984,
 28196640, 28611296, 29025952, 29440608, 29855264, 30269920, 30684576, 31099232, 31513888,
 31928544, 32343200, 32757856, 33172512, 33587168, 34001824, 34416480, 34831136, 35245792,
 35660448, 36075104, 36489760, 36904416, 37319072, 37733728, 38148384, 38563040, 38977696,
 39392352, 39807008, 40221664, 40636320, 41050976, 41465632, 41880288,

This will prepare all the new disk for use with the appliance. Please see Install the OpenBSD FAQ for a more in depth discussion on disks and partitions.

Copy the files to the new disk

First you have to shut down the services so that nothing will access any of the relevant files.

god stop mailserver

Preserve the original files and mount the new disk

mv /var/mailserver /var/mailserver.old
mkdir /var/mailserver
mount /dev/sd0c /var/mailserver

Copy all the files to the new filesystem

tar cfp - -C /var/mailserver.old . | tar xvfp - -C /var/mailserver

Final steps

All that is left to do now is to make sure that the new disk gets mounted on boot and restart all the services

echo "/dev/sd0c /var/mailserver ffs rw,softdep 2 2" >> /etc/fstab

and restart the server.

reboot

You now have some fresh disk space for the appliance, and when you've verified that all the files are intact, you can delete the /var/mailserver.old directory.

mailserver/adding_diskspace.txt · Last modified: 2010-01-14 11:55 by allard