TDMS Reserve File Size Function
- Updated2025-07-30
- 4 minute(s) read
Pre-allocates disk space for writing and prevents fragmentation on a file-system level. If you are running this function on Windows with User Account Control enabled, you must run LabVIEW or the application with administrator privileges to avoid a run-time error.
If you are using this function to build an application, National Instruments recommends that you embed an application manifest to the application. The requested execution level in the manifest file must be requireAdministrator.
When a .tdms file is in use by this function, no other processes can access this file.

Inputs/Outputs
append? (T)
—
append? specifies whether to append the new size that this function reserves to an existing file. If the value is FALSE, this function changes the file size of tdms file to the reserved size. If the value is TRUE, this function extends the file size of tdms file with the reserved size. The default is TRUE.
tdms file
—
tdms file specifies a reference number to the .tdms file on which to perform the operation. Use the TDMS Advanced Open function to open the refnum.
reserve size
—
reserve size specifies the size to reserve in samples. You can calculate the actual size, in bytes, that this function reserves by multiplying the value of reserve size by the number of bytes of data type. For example, if the value of reserve size is 512 and data type is an unsigned 16-bit integer, then you can calculate the actual size that this function reserves as follows: 512×(16÷8) = 1024 bytes. For large files of several terabytes, the operating system may take a significant amount of time to pre-allocate disk space. Insert a delay in your application after the TDMS Reserve File Size function to ensure the file size is fully reserved. For multiple files on separate RAID volumes, if you reserve the file size in a loop, insert a single delay after the loop to avoid serializing the delays. NI recommends a time delay of 500 ms/TB. Note If the disable buffering? input of the TDMS Advanced Open function is TRUE, the actual reserved size in bytes must be a multiple of the sector size of the hard disk. Use the TDMS Advanced Open function to obtain the sector size of the hard disk.
error in (no error)
—
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
data type
—
data type specifies the type of data on which you want to perform the operation. This input accepts integers, floating-point numbers, Booleans, and timestamps. Note You can wire the following floating-point numbers to this input:
tdms file out
—
tdms file out returns a TDMS file reference to the .tdms file on which you performed the operation.
error out
—
error out contains error information. This output provides standard error out functionality. |
Examples
Refer to the following example files included with LabVIEW.
- labview\examples\File IO\TDMS\Advanced Read and Write\Asynchronous Read and Write\TDMS Advanced Append Multiple Headers.vi
append? (T)
—
tdms file
—
reserve size
—
error in (no error)
—
data type
—
tdms file out
—
error out
—