misc/163051: Small disk sizes with 4k sectors have far too few inodes in RC2

Jason Bacon jwbacon at tds.net
Tue Jan 24 04:10:12 UTC 2012


The following reply was made to PR misc/163051; it has been noted by GNATS.

From: Jason Bacon <jwbacon at tds.net>
To: bug-followup at FreeBSD.org, teamdest at pbarletta.com
Cc:  
Subject: Re: misc/163051: Small disk sizes with 4k sectors have far too few
 inodes in RC2
Date: Mon, 23 Jan 2012 21:40:57 -0600

 FWIW: I've used this script to work around the issue until greater 
 control is available in the installer:
 
 #!/bin/sh -e
 
 ##########################################################################
 #   This script reformats /var, /tmp, and /usr with different FS
 #   parameters.  It was written for the purpose of increasing the number
 #   of inodes on a FreeBSD 9.0 system with a small disk (such as a
 #   VirtualBox VDI).  FreeBSD 9.0 uses a large default block size,
 #   resulting in too few inodes on /usr for a typical desktop system.
 #
 #   This script must be edited to suit your system.  It was tested on
 #   a 10G VDI with the following partitions:
 #
 #   /     ada0p2    1G
 #   SWAP  ada0p3    1G
 #   /var  ada0p4    512M
 #   /tmp  ada0p5    512M
 #   /usr  ada0p6    7G
 #
 #   On this system, the script increased inodes on /usr from about 500,000
 #   to about 3,000,000 (using 4096 byte blocks and 512 byte fragments).
 #
 #   It assumes you have enough space on / to store gzipped tarballs of
 #   /var, /tmp, and /usr.  For a fresh installation with a ports tree
 #   but no ports installed, this requires about 300mb.
 #
 #   I do not recommend using this script on anything but a fresh
 #   installation.  Doing so could result in loss of data.
 ##########################################################################
 
 # Edit these parameters to match your needs and partitions
 block_size=4096
 fragment_size=512
 var_dev=/dev/ada0p4
 tmp_dev=/dev/ada0p5
 usr_dev=/dev/ada0p6
 
 cd /
 
 if [ ! -e var.tgz ]; then
      printf "Packing /var...\n"
      tar zcf var.tgz --exclude var/.sujournal var
      df -i /var
 
      umount /var
      newfs -b $block_size -f $fragment_size $var_dev
      mount /var
 
      printf "Unpacking...\n"
      tar zxf var.tgz
      df -i /var
 fi
 
 if [ ! -e tmp.tgz ]; then
      printf "Packing /tmp...\n"
      tar zcf tmp.tgz --exclude tmp/.sujournal tmp
      df -i /tmp
 
      umount /tmp
      newfs -b $block_size -f $fragment_size $tmp_dev
      mount /tmp
 
      printf "Unpacking...\n"
      tar zxf tmp.tgz
      df -i /tmp
 fi
 
 if [ ! -e usr1.tgz ]; then
      # Back up commands and libs needed to unpack after reformatting
      printf "Backing up up /usr/bin and /usr/lib\n"
      cp -R /usr/lib /usr.lib
      cp -R /usr/bin /usr.bin
 
      printf "Packing /usr...\n"
      tar zcf usr.tgz --exclude usr/.sujournal usr
      df -i /usr
 
      # Reformat
      umount /usr
      newfs -b $block_size -f $fragment_size $usr_dev
      mount /usr
 
      # Commands and libs needed to unpack were in /usr, so use backups
      printf "Unpacking...\n"
      export PATH=${PATH}:/usr.bin
      export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr.lib
      tar zxf usr.tgz
      df -i /usr
 fi
 


More information about the freebsd-bugs mailing list