Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago. Improve this question How do I create a new file from a cpp program in Ubuntu, and is it any different from windows. Answer Declare a stream class
Tag: filesystems
Polling for readiness file
I work on Linux. How to know that a gzip file is ready? I have a server that polls files in directory /dir/. There is an another, independent process that gzip files to /dir/. How can my server know that file is ready? Answer There is no ready-made solution for this. Looking at the last modification timestamp of the file
how to choose chunk size when reading a large file?
I know that reading a file with chunk size that is multiple of filesystem block size is better. 1) Why is that the case? I mean lets say block size is 8kb and I read 9kb. This means that it has to go and get 12kb and then get rid of the other extra 3kb. Yes it did go and
Is running `sync` necessary after writing a disk image?
Common way to write an image to disk looks like: After this command, is it necessary to run sync? sync(2) explains it only flushes filesystem caches. Since dd command is not related to any filesystem, I think it is not necessary to run sync. However, block layer is complex and in doubt, most people prefers to run sync. Does anyone
Recursively re-spawn file on fsnotify Remove/Rename (Golang)
The Goal: I am attempting to monitor a file that is subject to being moved or deleted at any time. If and when it is, I’d like to re-generate this file so that an app can continue to write to it. Attempted: I have attempted to do this by implementing two functions, monitorFile() to listen for fsnotify events and send
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
Running out of space on Linux, copying 12GB of files to a 15GB file system
I have two virtual Linux servers, one for development and one in production, a typical setup one would expect. On the development server I have files that I need to copy to the production server, that amount to 12GB, well according to the “du -h” command. The production server has 15GB free, according to the “df -h” command. However, when
Deleting files after 7 days not working
I am trying to delete all files that are older than 7 days. The command is working but not correctly. It does delete files but it’s not accurate. The find does delete files, but when I run the ls command does contain files that should be deleted. For example today is November 7th. The find should delete all files before
The optimal way to lock and write to a file in Scala on Linux
I’m having a hard time finding the correct way to do any advanced file-system operations on Linux using Scala. The one which I really can’t figure out if best described by the following pseudo-code: Basically open a file in append mode (create it if it’s non existent), get an exclusive lock to it and write to it (with the implicit
where is the __init function of ext4?
As every module that is to be inserted in the kernel needs an __init function. where can I find the __init function of the original ext4 module written by linus torvalds? I want to make some changes in it. Answer I suppose you’re looking for this method : https://github.com/torvalds/linux/blob/master/fs/ext4/super.c#L5781 This __initmethod is the main one of the module because it