Tuesday, May 06, 2008

Adding extra disk to OpenBSD the fast way

This is to add an extra disk to OpenBSD system, in a simple and quick way. if you'd like to know more details and what we're doing by these commands, please go to OpenBSD faq "disk setup" page: http://www.openbsd.org/faq/faq14.html.

tested on openbsd 4.2.

NOTE: THIS  IS FOR LEARNING ONLY. DO NOT TRY ON YOUR PRODUCTION SERVER!!

1. power off your box

2. attache your disk to your computer

3. boot

4. login as root

5. check dmesg for the disk you just add.
     For a 2nd IDE disk, usually it's wd1; for 2nd SCSI disk, it's sd1 etc

6. run command: `fdisk -i wd1`, assuming it's 2nd IDE disk, brand new.

7. run command: `disklabel -E wd1`

8. under the disklabel command prompt, enter `a a` to add your first partition, accept all default setting in the following 3 prompt, the "offset" sector, end sector and fs type. this will make the whole disk as one partition "a"

9. enter 'q' to exit disklabel command and save your setting

10. run `newfs /dev/wd1a` to make new file system on the newly created partition.

11. make a directory, under which you want to mount the new partition to. `mkdir /vol0`.

12. run `mount /dev/wd1a /vol0`

13. you should be able to cd into /vol0 directory and do whatever you normally can do.
if you want to have this partition mounted automatically at every reboot, edit the "/etc/fstab" file, append to it the line `/dev/wd1a /vol0 ffs 1 1`

DONE.

No comments: