2013-09-08 09:58:46
0
category:
Freebsd
1.system configuration-disks
partion layout and sizes
partition size
Minimum Maximum
swap RAM / 8 2 * RAM
/ 256MB 512MB
/tmp 128MB 512MB
/var 128MB 1GB + RAM
/usr 1536MB 1.5GB++
内存 占用
vim /etc/rc.conf
tmpmfs="YES"
tmpsize="128m"
Swap
# swapinfo -h
#pstat -T
Adding More Swap space
# dd if=/dev/zero of=/swap0 bs=1024k count=256
# chown root:wheel /swap0
# chmod 0600 /swap0
#ls -l /swap0
-rw------ 1 root wheel 268435456 Apr 5 03:12 /swap0
vim /etc/rc.conf
swapfile="/swap0"
to make the new swap file active immediately
#mdconfig -l
md0
#mdconfig -a -t vnode -f /swap0
md1
#mdconfig -l -u 1
md1 vnode 256M /swap0
# swapon /dev/md1
#swapinfo -h
swap encryption
add .eli or .bde to the device name in the /etc/fstab
softupdates
# mount
# tunefs -n enable /
snapshots
# mksnap_ffs /var /var/snap1
# mount -u -o snapshot /var/snap1 /var
# fsck_ffs /var/snap1
# mdconfig -a -t vnode -f /var/snap1
# mount -r /dev/md2 /mnt
# mount
# umount /mnt
# mdconfig -d -u 2
# rm -f /var/snap1
Quotas
you should reconfig kernel and add the follow kernel config file
option QUOTA
# vim /etc/rc.conf
enable_quotas="YES"
# cat /etc/fstab
/dev/ads1f /usr/ ufs rw,usequota,groupquota 2 2
# quotacheck -a
quotacheck: creating quota file //quota.user
# quotacheck -v
Assigning Quotas
hard limit
# edquota jdoe
soft limit
# edquota -t0
Dump and Restore
# dump -oauL -f /usr/dump1 /dev/ad0sla
# dump -lauL -f /usr/dump2 /dev/ad0sla
updates /etc/dumpdates with new backup dates
# cat /etc/dumpdates
# dump -oauL -f /dev/adosla | bzip2 | ssh admin@bkserver dd of=/usr/backup/server1.dump
A typical restore procedure would look like the following command lines;
# newfs /dev/da0sla
# mount /dev/da0sla /mnt
# cd /mnt
# restore -r -f /usr/dump1
# restore -i -f /usr/dump1
The tar cpio and pax Utilities
# tar cvf backup.tar backup/
To update a barball , U flag is used;
# tar uvf backup.tar backup/
And x flag to extract the files from a tarball;
# tar xvf backup.tar
The -w flag used to create archive;
# pax -w -f backup.pax backup/
And -r to extract( or read ) the archive to currect directory;
# pax -r -f backup.pax
RAID0 -- Striping
#kldload geom_stripe
This can also be done through the /boot/loader.conf file, to automatically load the module during system boot up, by andding this line;
geom_stripe_load="YES"
# gstripe create stripe1 /dev/da1 /dev/da2
# newfs /dev/stripe/stripe1
# mount /dev/stripe/stripe1 /mnt
# gstripe label stripe1 /dev/da1 /dev/da2
# gstripe stop stripe1
RAID1 -- Mirroring
# gmirror label -b round-robin mirror1 da0 da1
# newfs /dev/mirror/mirror1
# mount /dev/mirror/mirror1 /mnt
# gmirror insert mirror1 da2
# gmirror remove mirror1 da1
# gmirror configure -b load mirror1
# gconcat label concat1 da0 da1 da2
# newfs /dev/concat/concat1
# mount /dev/concat/concat1 /mnt
# gconcat lable concat1 da3 da4
# growfs /dev/concat/concat1