• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Solaris : How to increase the Inodes on UFS file system with newfs command

By admin

It is not possible to dynamically increase the number of inodes on a UFS filesystem. If you need to increase the number of inodes you will need to build the filesystem afresh using newfs.

Note that the newfs command will create a new filesystem on the slice you specify. This will destroy all data already on the slice. If you wish to access the data on the slice after running newfs you must back it up first, and restore after running the newfs command as described below.

Increasing inodes with newfs

You can have a file system reporting that is it full, and yet when you look at the df -k output it looks like there should still be space left on the file system. The cause of this problem is due to a large number of small files on the file system. This can use up all of the inodes allocated for that file system while there is still plenty of disk space. To check for inodes, run the following command df -o i filesystem:

# df -o i /data

Filesystem iused ifree %iused Mounted on
/dev/dsk/c0t0d0s7 13 1241587 0% /data

As you can see I don’t have a problem with the inodes, if you did have a problem the output from would indicate %iused 100%. There is a way to resolve this issue, first you need to get a good backup of the affected file system. Then you can run the mkfs -m command to see how any filesystem was created, as seen below.

# mkfs -m /dev/rdsk/c0t0d0s7
mkfs -F ufs -o
nsect=255,ntrack=16,bsize=8192,fragsize=1024,cgsize=26,free=1,rps=90,nbpi=8235,opt=t,apc=0,gap=0,nrpos=8,maxcontig=16
/dev/rdsk/c0t0d0s7 20481600

The key field from the about output is nbpi=8235 (number bytes per inode). The nbpi can be changed when running the newfs command to create a new file system. The following is from the newfs man page.

-i nbpi

The number of bytes per inode. This specifies
the density of inodes in the file system. The
number is divided into the total size of the
file system to determine the fixed number of
inodes to create. It should reflect the expected
average size of files in the file system. If
fewer inodes are desired, a larger number should
be used; to create more inodes a smaller number
should be given. The default for nbpi is as fol-
lows:.
Disk size Density
Less than 1GB 2048
Less than 2GB 4096
Less than 3GB 6144
3GB to 1 Tbyte 8192
Greater than 1 Tbyte 1048576
or created with -T

After you backup the file system you want to increase the inodes on, then you newfs the file system using the -i nbpi option specifying a smaller number. As the output from the mkfs -m /dev/rdsk/c0t0d0s7 shows nbpi=8235, if you cut that number in half when running the newfs command with the nbpi option (-i 4117) it will double your inodes on that file system. Then after doing a newfs and increasing their inodes you restore the file system from the backup you created prior to starting this process.

Filed Under: Solaris

Some more articles you might also be interested in …

  1. Solaris ZFS : How to Designate Hot Spares in a Storage Pool
  2. Examples of adding static routes in Solaris
  3. How to collect XSCF snapshot on M-series servers (M3000 / M4000 / M5000 / M8000 / M9000)
  4. Troubleshooting Solaris IPMP
  5. Solaris 11 : Increasing the size of a vdisk in LDom ( with backend device as ZFS volume )
  6. How to enable or disable telnet in Solaris 10
  7. How Passwordless SSH works in Linux / UNIX
  8. How to install and configure sudo in solaris 10 (SPARC and x86/x64)
  9. 7 Useful Find Command Examples to Locate files to remove when a filesystem is full
  10. How to log SSH login attempts to a file in Solaris

You May Also Like

Primary Sidebar

Recent Posts

  • MySQL: how to figure out which session holds which table level or global read locks
  • Recommended Configuration of the MySQL Performance Schema
  • MySQL: Identify what user and thread are holding on to a meta data lock that is preventing other queries from running
  • MySQL: How to kill a Long Running Query using max_execution_time
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary