Defcon-1-Logo

           [Home]    [FBSD Articles]    [Scripts Corner]    [Contribute]    [Search]    [FBSD Links]    [Files]

About Us

FreeBSD Articles
  *Hardware
  *Networking
  *Security
  *Software
  *X Windows


Files / Scripts
Newbies Corner
Tech. Talk
Tips and Tricks


FreeBSD Links

Articles in other
Languages :
  *French Articles
  *Spanish Articles

Want to Help ?
 
   Click Here

Email Users5

Search:
 

 


FreeBSD Search:


 

 

Powered-By-Apache-Logo
Defcon1 Logo

Installation of Soft Updates

   If there are any questions or comments, please direct them to walt@erudition.net . The newest copy of this HowTo can always be retrieved from www.freebsd-howto.com. All rights for the reproduction of this document are reserved.

Summary:

 This HowTo will cover the installation of Soft Updates, including how to do the necessary kernel modifications and enabling/disabling it for the desired filesystems.


Outline.
 

 1. Background

 2. Installation

     2.1.  Installing Source Files

     2.2.  Adding Kernel Option

     2.2.  Adding Kernel Option

     2.3.  Recompiling Kernel

 2.4.  Booting into Single User Mode and Unmounting Filesystems

     2.5.  Enabling/Disabling Soft Updates

 3. Appendix
 

 Soft Updates are a powerful method for increasing filesystem performance. They decrease synchronous I/O and increase asynchronous I/O which increases disk activity speed and decreases disk I/O through a 'trickle sync' facility that is incorporated into the kernel for more efficient disk synching operations. The code is very stable, although, there have been some occasional reports of difficulties. Soft Updates will not cause filesystem corruption, but, if they begin causing difficulties, then can be turned off easily with the tunefs(8) command. To learn more about how Soft Updates work, please read

/usr/src/sys/contrib/softupdates/README.

 

 Before Soft Updates can be installed, the system must have the kernel source so that the kernel can be recompiled with the necessary kernel patches. To learn more about updating/downloading the system/kernel source code, check out: http://www.freebsd.org/handbook/synching.html#CVSUP  and for building and installing a custom kernel, check out: http://www.freebsd.org/handbook/kernelconfig-building.html 

 This HowTo will only in the most cursory fashion cover kernel compilation.

 2. Installation

 

 2.1. Installing Source Files

 

 After the kernel source code is present in /usr/src/sys, one is ready to begin the installation procedure for Soft Updates. The Soft Updates files are located in /usr/src/sys/contrib/softupdates. They must be linked into /usr/src/sys/ufs/ffs, which contains the source for the FFS filesystem:

 cd /usr/src/sys/ufs/ffs

 ln -s ../../contrib/softupdates/*.[ch] .

 

 2.2. Adding Kernel Option

 

 Next, the Soft Updates kernel option must be added into one's

kernel config. this can be easily done with your favourite text editor.

Add 'option SOFTUPDATES' and then save the kernel config.

 

 2.3. Recompiling Kernel

 

 Now, one must recompile the kernel. Assuming that one's kernel config is named SOFT, the following steps would suffice. Remember, you must do this as root:

 cd /usr/src/sys/i386/conf

 /usr/sbin/config SOFT

 cd ../../compile/SOFT

 make depend; make; make install

 

 2.4. Booting into Single User Mode and Unmounting Filesystems

 Once the build and install is complete, one must reboot into single user mode and unmount every filesystem that one wishes to use with Soft Updates. Remember, enabling Soft Updates like any other filesystem tuning procedure must be done on unmounted filesystems; as such, executing the procedure in single user mode is imperative. You can easily drop into single user mode by typing:

 shutdown now

 
Once in, type:

  unmount -a

 

 If any filesystems are still in use and can not be unmounted, then one will need to either stop the processes that are using those filesystems or reboot. To reboot into single user mode, do the following:

 

 a) Type: reboot

 b) When the boot disk loads and begins the (default) 10 second count-down prior to kernel loading, hit <space>. One will be dropped into the booter prompt.

 c) Type: boot -s

 

 At this point, the kernel will load and the system will boot into

single user mode.

 

 2.5. Enabling Soft Updates

 

 Now, one must enable the Soft Updates option for each filesystem with tunefs(8). For instance, to enable Soft Updates for the /usr filesystem, and /usr has a corresponding entry in /etc/fstab, the following will accomplish this:

 tunefs -n enable /usr

 

 Enable Soft Updates for the filesystems with the highest I/O activity. Filesystems such as /usr, /tmp, and /var are excellent candidates. /home may also experience much I/O activity if one has many users. / rarely experiences much I/O activity.

 Having enabled Soft Updates for the desired filesystems, type 'exit' at the single-user prompt, and the system will boot into multi-user mode. Likewise, one can reboot and allow the system to boot into multi-user.

 To verify that Soft Updates have been enabled, once in multi-user mode, one can type 'mount' without any options and this will indicate the 'soft-updates' option for each filesystem for which Soft Updates had been enabled. For instance:

 

(root@erudition)/usr/src/sys/ufs/ffs># mount

/dev/wd0s1a on / (ufs, NFS exported, local, writes: sync 92 async 54296)

/dev/wd0s1g on /home (ufs, NFS exported, local, soft-updates, writes: sync

29193 async 312766)

/dev/wd0s1e on /tmp (ufs, local, soft-updates, writes: sync 2 async 12961)

/dev/wd0s1h on /usr (ufs, NFS exported, local, soft-updates, writes: sync

4 async 266829)

/dev/wd0s1f on /var (ufs, local, soft-updates, writes: sync 549 async

448936)

procfs on /proc (procfs, local)

 

 Characteristic of Soft Updates performance, the 'sync' (synchronous I/O) value will be drastically lower than the 'async' (asyncronous I/O) value.

 To disable Soft Updates for a particular filesystem, one must likewise boot into single user mode and run 'tunefs -n disable' for the intended filesystem.

 

 Appendix.

 

 http://www.freebsd.org/handbook/synching.html#CVSUP

 http://www.freebsd.org/handbook/kernelconfig-building.html

 /usr/src/sys/contrib/softupdates/README

 /usr/src/sys/ufs/ffs/README.softupdates

 tunefs(8)
 
 Lasker  v1.0

Email Us

ghostrdr@defcon1.org

This site cannot be duplicated without permission

© 1998 - 2010 Defcon1, www.defcon1.org. Copyrights for all materials on this web site are held by the individual authors, artists, photographers or creators. Materials may not be reproduced or otherwise distributed without permission of www.defcon1.org and the content's original author.