Skip to main content
NetApp Response to Russia-Ukraine Cyber Threat
In response to the recent rise in cyber threat due to the Russian-Ukraine crisis, NetApp is actively monitoring the global security intelligence and updating our cybersecurity measures. We follow U.S. Federal Government guidance and remain on high alert. Customers are encouraged to monitor the Cybersecurity and Infrastructure Security (CISA) website for new information as it develops and remain on high alert.
NetApp Knowledge Base

What is maxdirsize?

Last Updated:


Applies to

  • ONTAP 9
  • Cloud Volumes ONTAP
  • Data ONTAP 8


What is maxdirsize?
  • Maxdirsize is a volume level option that limits the maximum size to which a directory file can grow.
  • Maxdirsize determines the number of files a directory can hold.
  • The default maxdirsize is 320MB
  • Most environments do not need to change this setting
  • The default value of 320MB can be increased as necessary.
  • It is recommended not to configure the size larger than necessary, as certain directory operations require the entire directory to be memory resident.
  • And once the maxdirsize is increased, it cannot be reduced without recreating the directory.


Which directory does maxdirsize refer to?
  • The maxdirsize is a volume level option and limits every directory with-in that volume


What happens when the directory size reached maximum value?
  • When a directory hits the maximum default or configured value of maxdirsize, the new file creates will likely fail. 
    • New files may continue to be created if there is a background cleanup operation running (i.e. a snap delete).
  • And an error message similar to the following will also be triggered via EMS:
Mon Oct 25 08:06:04 -0600 [sj-filer01-01: wafl_exempt09: wafl.dir.size.max:error]: Directory size for fileid 10386 in volume 
vol1 reached the maxdirsize limit.
  • In the above EMS, the fileid mentioned is the inode number of the directory. Following procedure can be used to identify the directory path.

sj-filer01::*> run -node sj-filer01-01
sj-filer01-01> priv set advanced
sj-filer01-01*> inodepath -v vol1 10386
Inode 10386  in volume vol1 (fsid 0x402) has 1 name.
Volume UUID is: 25cc6243-bf4f-11ec-9f34-00a098d42f51
[    1] Primary pathname = /vol/vol1/mydir1
sj-filer01-01*> exit



sj-filer01::*> set diag

sj-filer01::*> volume explore inode -scope vol1.10386 -dump name
found 1026.64/mydir to be inode 1026.30086

sj-filer01::*>set admin



How to identify the current maxdirsize?
  • The directory size can be obtained from an NFS client using simple 'ls -ldh <path to directory>'

[root@sj-2_rhel7 ~]# ls -ldh /mnt/mydir
drwxr-xr-x. 2 siva siva 320M Oct 27 14:16 /mnt/mydir1
[root@sj-2_rhel7 ~]#

  • The directory size in bytes can also be identified using the native ONTAP commands as below:

sj-filer01::*> set diag

sj-filer01::*> volume explore inode -scope vol1./mydir1 -dump size
found 1026.64/mydir1 to be inode 1026.30086

sj-filer01::*>set admin

Note:  The above command is a diag privilege command.

Note: Following command can be used to identify both size and directory path:

Mon Oct 25 08:06:04 -0600 [sj-filer01-01: wafl_exempt09: wafl.dir.size.max:error]: Directory size for fileid 10386 in volume 
vol1 reached the maxdirsize limit.

sj-filer01::> set -priv diag
sj-filer01::*> volume explore inode -scope vol1.10386 -dump name,size



How to address the maxdirsize issue?
  • There are two ways you can address once a directory hits the maxdirsize
    1. Increase the maxdirsize
    2. Create a new directory and place the new files to the new directory, where possible
  • Additionally, if a large number of files have been deleted from a directory, you can reduce the directory space by completing the following steps:
  1. Copy the files into a temporary directory.
  2. Delete the original directory.
  3. Rename the temporary directory with the original directory name.
  • If only a few files were deleted or the procedure did not help to decrease the directory file size, increase maxdirsize.


How to increase the maxdirsize?
  • It is recommended that you may only increase maxdirsize in 2% increments

For systems running ONTAP 9

  • Increase the maxdirsize using the following command:

 volume modify -vserver {NAME} -volume {NAME} -maxdir-size {size}

  • The following example set a maximum directory size of 500MB for a volume named vol1on a virtual server named svm1.

sj-filer01::> set advanced

sj-filer01::*>  volume modify -vserver svm1 -volume vol1 -maxdir-size 500MB

Volume modify successful on volume: vol1
sj-filer01::*> volume show -volume vol1 -fields maxdir-size
(volume show)
vserver volume maxdir-size
------- ------ -----------
svm1     vol1   500MB
sj-filer01::*> set admin

  • Note: You need to have the privilege level set to advanced to run the above command.


For systems running Data ONTAP 8 (7-Mode)

  • Increase the maxdirsize using the following command:

filer> vol options volname maxdirsize {size in Kb}


sj-7mode> vol options vol1 maxdirsize 524288

Is changing maxdirsize immediate?
  •  Yes, you can change maxdirsize on the fly to increase the directory size when the users are connected to the filer.


Do files and directories located in .snapshot need to be included in the calculation?
  • No, files and directories located in the snapshots does not account towards maxdirsize.


Deleting files in a directory causes the dir size to reduce?
  • No, as noted earlier, deleting files in a directory does not reduce the directory file size.
  • It will only allow new files to be created until the maxdirsize.


If the storage system is upgraded, will maxdirsize be increased?
  • No. Volumes retain their created maxdirsize. 


If the volume is migrated from earlier releases of ONTAP, will maxdir-size be increased?
  • No. Earlier Data ONTAP releases used the system memory size as the base for determining the maxdirsize.
  • Upon migration, the volumes will retain their original maxdirsize and can be increased as required.


What are the performance impacts of changing the size of maxdirsize?
  • Performance issues are hard to quantify, but easy to state in a general sense.
  • Lookups in a large directory consume lots of CPU.
  • Converting a large directory from NFS only to CIFS takes lots of resources over a long period of time.
  • An additional performance impact is that when a directory is loaded into memory, the entire directory tree is loaded.
  • Parts of it may fall out of memory through non-use, but there is a performance impact from reading from disk and finding space in-memory for the directory to be stored.
How does enabling the 'create_ucode' and 'convert_ucode' volume options affect maxdirsize?
  • Under Data ONTAP 7Mode, following message may also appears after enabling the 'create_ucode' and 'convert_ucode' volume options.

Error message: [myvol@filer: wafl.dir.size.max:warning]: Directory [dir] has reached the maxdirsize limit. Please increase the maxdirsize by using the vol options command.

  • Increasing maxdirsize may not solve the problem since the message is caused by the conversion of Unicode on the filer.
  • The snapshots on the filer are locking the filesystem from changes, so temporary files are being created when non-Unicode data is being accessed. 
  • In this case, delete the snapshots that were created before the 'convert_ucode' and 'create_ucode' options were enabled.
  • This allows the existing data to be converted to Unicode format without creating extra temporary data on the volume. Leave the 'convert_ucode' and 'create_ucode' options enabled.


Scan to view the article on your device