I have a couple hundred thousand files in one of the directory on a Redhat Linux server. I need to execute ls -t to fetch the name of the last edited file and upload the filename to a database. Lately I have started facing problems as the number of files in the directory keeps growing and want to know the
Tag: ext4
Get filesystem creation date in C
I need to know the creation datetime of the filesystem on a disk (in a Linux machine) with C. I would like to avoid using shell commands, such as and make a parser. Thanks Answer From a program coded in C (or in any language capable of calling C routines) you would use the stat(2) system call (or, with recent
Understanding Linux write performance
I’ve been doing some benchmarking to try and understand write performance on Linux, and I don’t understand the results I got (I’m using ext4 on Ubuntu 17.04, though I’m more interested in understanding ext4 if anything, than I am in comparing filesystems). Specifically, I understand that some databases/filesystems work by keeping a stale copy of your data, and then writing
Filesystem for a partition goes missing EC2 reboot
I created a d2.xlarge EC2 instance on AWS which returns the following output: The default /etc/fstab looks like this Now, I make an EXT4 filesystem for xvdc blkid returns a UID for the filesystem Then, I mount it on /mnt5 It gets succesfully mounted. Till there, the things work fine. Now, I reboot the machine(first stop it and then start
What is the fastest way to increase the size of a file in linux on a ext4 filesystem from a C executable without creating holes in the file?
The fastest way to increase the file size that I know of would be to ftruncate() or lseek() to the desired size and write a single byte. That doesn’t fit my needs in this case because the resulting hole in the file doesn’t reserve space in the file system. Is the best alternative to use calloc() and write()? Perhaps this
Is rename() without fsync() safe?
Is it safe to call rename(tmppath, path) without calling fsync(tmppath_fd) first? I want the path to always point to a complete file. I care mainly about Ext4. Is the rename() promised to be safe in all future Linux kernel versions? A usage example in Python: Answer No. Look at libeatmydata, and this presentation: Eat My Data: How Everybody Gets File