Bug 163051 - Small disk sizes with 4k sectors have far too few inodes in RC2
Summary: Small disk sizes with 4k sectors have far too few inodes in RC2
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-04 10:13 UTC by Patrick Barletta
Modified: 2017-12-31 22:32 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Barletta 2011-12-04 10:13:48 UTC
When installing a 9.0 system to a small disk (such as might be used on a virtual machine), so few inodes are allocated that after the installation of the ports tree and possibly one or two trivial operations, no inodes are left free. Supposedly this is a problem related to the switchover to 4k sectors from 512 byte ones, but I have not verified that. The solution may be as simple as change the inode allocation density when installing on small system drives (in this case, a 5GB VMDK drive under vSphere 5)

Fix: 

Possibly change the inode allocation density when running newfs on the system at installation.
How-To-Repeat: Install FreeBSD 9.0 RC2 on a small system partition (Under 8 GB or so).
Comment 1 bacon 2012-01-03 17:54:59 UTC
I've run into the same issue on RC3, and would argue for higher severity 
and priority.  There does not seem to be a workaround in the 
installation process (e.g. the ability to add newfs flags during 
partitioning), and this prevents the completion of a desktop 
installation on a 10 gig VDI under VirtualBox.  Below is output after a 
basic XFCE setup and only a few applications:

Filesystem   1K-blocks      Used    Avail Capacity iused    ifree 
%iused  Mounted on
/dev/ada0a      515612    222640   251724    47%    2054    31224    6%   /
devfs                1         1        0   100%       0        0  
100%   /dev
/dev/ada0d     1031708     32700   916472     3%    2671    63375    
4%   /var
/dev/ada0e      515612      4184   470180     1%      20    33258    
0%   /tmp
/dev/ada0f     7220888   3761132  2882088    57%  440632    32966   
93%   /usr
procfs               4         4        0   100%       1        0  
100%   /proc

I agree that a simple check for disk size in the installer would be a 
reasonable solution.

Cheers,

-- 

-----------------------------------------------
   Jason W. Bacon
   Systems Programmer
   UITS High Performance Computing Group
   University of Wisconsin Milwaukee
   bacon@uwm.edu
-----------------------------------------------
Comment 2 Jason W. Bacon freebsd_committer 2012-01-24 03:40:57 UTC
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
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:12 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped