ftruncate64 - Linux
Overview
ftruncate64 modifies the size of a file to the specified length in bytes. It effectively truncates or extends the file as needed. This command is commonly used for file manipulation, resizing partitions, or allocating disk space.
Syntax
ftruncate64 [-h] [-c] [-e FALLBACK] FILENAME LENGTH
Options/Flags
- -h, –help: Display usage information.
- -c: Do not follow symbolic links.
- -e FALLBACK: Specifies the fallback size to be used when the requested length is not valid. The default fallback size is 0.
Examples
Truncate a file to 100 bytes
ftruncate64 file.txt 100
Extend a file to 2GB
ftruncate64 file.img 2048m
Common Issues
- Incorrect Length: Ensure the specified length is valid for the file system and file type.
- Permissions: Verify that you have the necessary permissions to modify the file.
Integration
ftruncate64 can be used in conjunction with other commands, such as:
- truncate: A version of ftruncate64 that works on 32-bit systems.
Related Commands
- truncate: Modify the size of a file to a specific length.
- dd: Copy and convert data.
- resize2fs: Resize an ext2/ext3/ext4 file system.