Skip to main content
NetApp Knowledge Base

What is maxdirsize?

Views:
15,995
Visibility:
Public
Votes:
4
Category:
ontap-9
Specialty:
core
Last Updated:

 

Applies to

  • ONTAP 9
  • Data ONTAP 8

Answer

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

 

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 12K Oct 27 14:16 /mnt/mydir
[root@sj-2_rhel7 ~]#

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

sj-filer01::*> set diag

Warning: These diagnostic commands are for use by NetApp personnel only.
Do you want to continue? {y|n}: y

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

sj-filer01::*>set admin

Note:  The above command is a diag privilege command.

 

What happens when the directory size reached maximum value?
  • When the maxdirsize hits the maximum default or configured value, 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.
 

 

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}

Example:

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.