Friday, April 4, 2008

After having been wanting to for ages I have finally fixed up my OpenBSD machines partitions.


I had an 80GB hard drive formated (wd1a) and moved /usr/local/ on to it and put my SMB shares on it for the free space.


Since wd0 is a 8GB disk split into a, b, h, d, g, and e partitions the biggest is wd0g mounted on /usr with ~6GB free but I had almost 10GB of files on /usr/local (wd1a). So I had to copy my backups and videos to the windows machine via Samba/Network Neighborehood before I could move all of my files in /usr/local/srv to a temporary place in /usr and then archived the rest of the directory.


cd /usr
mkdir storage
mv local/srv storage
tar -cf /var/tmp/local.tar local

I had to relabel the disk and then format the partitions, I created wd1a and wd1d to use as /usr/local and /srv with ~15GB more free space in case I need it.

umount -f local
disklabel -E wd1
newfs wd1a
newfs wd1d

During the disk label I changed to 'disk geometry' (g d), deleted the a partition (d a) and created the a and d partitions (c a and c d) keeping with the prompts on it and specifying 12G and 45G for the partition sizes.


Fixed my fstab and then mounted the partitions

vi /etc/fstab
# 8GB Primary Master, PATA drive
# device        mount   type    opts            dump    fsck
/dev/wd0a       /       ffs     rw              1       1
/dev/wd0h       /home   ffs     rw,nodev,nosuid 1       2
/dev/wd0d       /tmp    ffs     rw,nodev,nosuid 1       2
/dev/wd0g       /usr    ffs     rw,nodev        1       2
/dev/wd0e       /var    ffs     rw,nodev,nosuid 1       2
# 80GB Primary Slave, PATA drive
# device        mount           type    opts    dump    fsck
/dev/wd1a       /usr/local      ffs     rw,nodev        1       2
/dev/wd1d       /srv            ffs     rw,nodev,nosuid 1       2

mount -o rw,nodev /dev/wd1a /usr/local
mount -o rw,nodev,nosuid /srv

I'm some what tempted to mark wd1d 'noexec' but I may wish to run scripts from there later if I ever move ~/code over. After that it was just a quick hop, skip, and jump to restore my files.

tar xpf /var/tmp/local.tar
mv storage/srv/smb /srv/
vi /etc/samba/smb.conf

I corrected all of my shares in smb.conf from command line mode:

:1,$s/\/usr\/local\/srv/\/srv/g

I could've used ex but I rather like paging up/down with ^U and ^D instead of using 'addr1,addr2p' in ex.

mount
/dev/wd0a on / type ffs (local)
/dev/wd0h on /home type ffs (local, nodev, nosuid)
/dev/wd0d on /tmp type ffs (local, nodev, nosuid)
/dev/wd0g on /usr type ffs (local, nodev)
/dev/wd0e on /var type ffs (local, nodev, nosuid)
/dev/wd1a on /usr/local type ffs (local, nodev)
/dev/wd1d on /srv type ffs (local, nodev, nosuid)
# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/wd0a      147M   30.4M    110M    22%    /
/dev/wd0h      393M   35.6M    337M    10%    /home
/dev/wd0d     98.3M    2.0K   93.4M     0%    /tmp
/dev/wd0g      6.7G    398M    6.0G     6%    /usr
/dev/wd0e      148M   84.1M   56.2M    60%    /var
/dev/wd1a     11.8G   76.9M   11.1G     1%    /usr/local
/dev/wd1d     44.3G    5.1G   37.0G    12%    /srv


Windows wouldn't see the file shares and sending the HUP signal to Samba to reread it's conf file immediately didn't help any. So I gave Vectra a reboot to double check my fstab entry (yes I am paranoid), I could've just killed the processes and reloaded them manually for the same effect.

# uptime
 9:14PM  up 19 days,  3:29, 1 user, load averages: 4.12, 4.16, 3.86
# reboot


I love OpenBSD :-)


EDIT:

To prevent some nasty time outs.

vi /etc/ssh/sshd_config
ClientAliveInterval 15
ClientAliveCountMax 45

vi ~/.ssh/config # or /etc/ssh/ssh_config for all clients
ServerAliveInterval 15

No comments:

Post a Comment