How can I create a /dev/null-like “blackhole” directory?How do I point certain directory to /dev/null?Can...
How to split a string by the third .(dot) delimiter
Job offer without any details but asking me to withdraw other applications - is it normal?
I see your BIDMAS and raise you a BADMIS
Does the word “uzi” need to be capitalized?
Wrathful Smite, and the term 'Creature'
Why are some Mac apps not available on AppStore?
Usage of Offrir and Donner
Why was "leaping into the river" a valid trial outcome to prove one's innocence?
Are scroll bars dead in 2019?
Determining if file in projected or geographic coordinates using ArcGIS Desktop?
2.5 year old daughter refuses to take medicine
Gas pipes - why does gas burn "outwards?"
How was Carlo's plan supposed to work?
How to create a list of dictionaries from a dictionary with lists of different lengths
Should I use my toaster oven for slow roasting?
How to circle together certain entries of a matrix?
Awesomism and its awesome gods
Could the government trigger by-elections to regain a majority?
Is there a basic list of ways in which a low-level Rogue can get advantage for sneak attack?
Stack class in Java 8
Has any object launched from Earth gone into the Sun?
Random point on a sphere
How flexible are number-of-pages submission guidelines for conferences?
Expected value until a success?
How can I create a /dev/null-like “blackhole” directory?
How do I point certain directory to /dev/null?Can I prevent a file from being created?How can I trick Plex Media Server into writing logs to a black hole?Is it possible to trick a program into thinking it write successfully but don't write anything to disk?Is there a kind of '/dev/null' to fake output file path?Monitor directory and if a file is requested then rsync on demandCreate a recursive diff directory. Copy reference and diff. Recreate original directoryHow to strip directory structure with command line (or script)Can two files in a directory be on different filesystemsHow can there be a directory named `~`?How to output files to another directory (Poppler - pdftotext)Should I use single or double angle brackets to redirect to /dev/null?Is it safe to store persistent data into /var/app_name/Finding modified files in realtime?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I would like to create a "/dev/null" directory (or a "blackhole" directory) such that any files written to it are not really written, but just disappear.
I have an application that writes out large temporary files to a directory. I have no control over the name of the files and I don't really care about the content of these files. I could write a script that periodically clobbers these files, but the files are written out very quickly and fill my disk. I'm looking for something cleverer. I want the application to "think" that it is writing out these files, when in fact, the writes are just being discarded at the other end.
Also see this old related thread.
filesystems directory io-redirection
add a comment |
I would like to create a "/dev/null" directory (or a "blackhole" directory) such that any files written to it are not really written, but just disappear.
I have an application that writes out large temporary files to a directory. I have no control over the name of the files and I don't really care about the content of these files. I could write a script that periodically clobbers these files, but the files are written out very quickly and fill my disk. I'm looking for something cleverer. I want the application to "think" that it is writing out these files, when in fact, the writes are just being discarded at the other end.
Also see this old related thread.
filesystems directory io-redirection
It sounds like FUSE might be an option: kerneltrap.org/mailarchive/linux-kernel/2008/2/15/868564/thread
– Stefan Lasiewski
Mar 16 '11 at 20:32
i just asked myself the same question, and used the same name for the directory i failed to create.
– ixtmixilix
Mar 3 '13 at 6:56
add a comment |
I would like to create a "/dev/null" directory (or a "blackhole" directory) such that any files written to it are not really written, but just disappear.
I have an application that writes out large temporary files to a directory. I have no control over the name of the files and I don't really care about the content of these files. I could write a script that periodically clobbers these files, but the files are written out very quickly and fill my disk. I'm looking for something cleverer. I want the application to "think" that it is writing out these files, when in fact, the writes are just being discarded at the other end.
Also see this old related thread.
filesystems directory io-redirection
I would like to create a "/dev/null" directory (or a "blackhole" directory) such that any files written to it are not really written, but just disappear.
I have an application that writes out large temporary files to a directory. I have no control over the name of the files and I don't really care about the content of these files. I could write a script that periodically clobbers these files, but the files are written out very quickly and fill my disk. I'm looking for something cleverer. I want the application to "think" that it is writing out these files, when in fact, the writes are just being discarded at the other end.
Also see this old related thread.
filesystems directory io-redirection
filesystems directory io-redirection
edited Mar 16 '11 at 21:45
Gilles
574k140 gold badges1184 silver badges1696 bronze badges
574k140 gold badges1184 silver badges1696 bronze badges
asked Mar 16 '11 at 8:57
dogbanedogbane
15.6k10 gold badges65 silver badges58 bronze badges
15.6k10 gold badges65 silver badges58 bronze badges
It sounds like FUSE might be an option: kerneltrap.org/mailarchive/linux-kernel/2008/2/15/868564/thread
– Stefan Lasiewski
Mar 16 '11 at 20:32
i just asked myself the same question, and used the same name for the directory i failed to create.
– ixtmixilix
Mar 3 '13 at 6:56
add a comment |
It sounds like FUSE might be an option: kerneltrap.org/mailarchive/linux-kernel/2008/2/15/868564/thread
– Stefan Lasiewski
Mar 16 '11 at 20:32
i just asked myself the same question, and used the same name for the directory i failed to create.
– ixtmixilix
Mar 3 '13 at 6:56
It sounds like FUSE might be an option: kerneltrap.org/mailarchive/linux-kernel/2008/2/15/868564/thread
– Stefan Lasiewski
Mar 16 '11 at 20:32
It sounds like FUSE might be an option: kerneltrap.org/mailarchive/linux-kernel/2008/2/15/868564/thread
– Stefan Lasiewski
Mar 16 '11 at 20:32
i just asked myself the same question, and used the same name for the directory i failed to create.
– ixtmixilix
Mar 3 '13 at 6:56
i just asked myself the same question, and used the same name for the directory i failed to create.
– ixtmixilix
Mar 3 '13 at 6:56
add a comment |
6 Answers
6
active
oldest
votes
This isn't supported out-of-the-box on any unix I know, but you can do pretty much anything with FUSE. There's at least one implementation of nullfs¹, a filesystem where every file exists and behaves like /dev/null (this isn't the only implementation I've ever seen).
¹
Not to be confused with the *BSD nullfs, which is analogous to bindfs.
Fantastic - I've used this as part of an answer on SO
– Phil Lello
May 5 '11 at 21:52
1
a note to people who end up with compile errors on that program:g++ -Wall -o nullfs nullfs.c++ `pkg-config fuse --cflags --libs`worked for me.
– ixtmixilix
Mar 3 '13 at 7:11
Can you point me to other implementations? Because I can't find any
– Freedo
Aug 2 at 4:50
@Freedo I suspect many people have done it as a learning exercise and let it go unmaintained. They might not be on the web anymore.
– Gilles
Aug 2 at 6:07
add a comment |
Another approach would be a LD_PRELOAD wrapper; basically a small shared library which is loaded before libc.so, and intercepts calls to "open" with something that checks the prospective file path and substitutes "/dev/null" if it would be in the target directory.
This has the advantage of being
(a) entirely in user-space - no kernel hacking required; and
(b) only affecting the single errant application.
A simple example is at http://www.noah.org/wiki/LD_PRELOAD_notes, but in your case you will want to intercept the "open" & "creat" system calls.
3
...assuming the application does system calls via libc, not directly viaint 0x80/syscall/sysenter/whatever else.
– Ruslan
Feb 7 '16 at 18:44
add a comment |
If the program is so stupid to not let you switch those logs off, may be it also doesn't check for errors after opening a log file? I'd try mounting some dummy read-only file system (e.g. using mount -o loop.)
this approach doesn't work unfortunately. The application dies if it can't write to this file.
– dogbane
Mar 16 '11 at 12:22
add a comment |
You say that removing the files periodically with a script isn't fast enough. Could you live with a trigger that deletes a temporary file any time your application finishes writing and closes it? If so, you might make use of the "inotify" API.
(See http://en.wikipedia.org/wiki/Inotify and https://github.com/rvoicilas/inotify-tools/wiki/)
1
On many systems, deleting a file that a process has open removes its directory entry, but the file itself stays on disk until it is closed by the last process using it. Processes might write files and then seek to the beginning and read them back, and so the OS can't just throw the data away.
– interfect
Apr 18 '17 at 21:58
add a comment |
i have created a kernel module based on the ramfs example in the linux kernel,
it is basically a blackhole filesystem called nullfsvfs. The FUSE system implementation needs to copy data from user to kernelspace and is quite slow, compared to a straight implementation as kernel module. See:
https://github.com/abbbi/nullfsvfs
New contributor
michael is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Just symlink that directory to /dev/null
rm -rf ~/.logs
ln -s /dev/null ~/.logs
/dev/null, doesn't have to be a directory. If the program tries writing to ~/.logs/log1.dump, it still goes right into /dev/null.
I do this for Google Chrome's cache because after a while it gets so big that Chrome will take minutes to start.
3
This wouldn't work because symlinks are files, not directories. Tryingecho hello > ~/.logs/log1.dumpgives~/.logs/log1.dump: Not a directory. However,echo hello > ~/.logsworks because .logs is a file.
– dogbane
Mar 16 '11 at 13:25
2
You must be kidding us.$ ln -s /dev/null dev-null; touch dev-null/zzzgives metouch: cannot touch 'dev-null/zzz': Not a directory
– alex
Mar 16 '11 at 13:28
1
Like I said, it works for Chrome. It prevents it from writing into the cache. If it causes the asker's program to crash, then obviously it doesn't check if file pointers are NULL.
– jonescb
Mar 16 '11 at 13:54
6
It probably means that Chrome skips writing if there is an error opening the file. You could achieve the same effect by removing write permission from the dump file or the directory its writing in.
– KeithB
Mar 16 '11 at 14:04
True, changing the permissions of the directory would probably make more sense.
– jonescb
Mar 16 '11 at 14:53
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f9332%2fhow-can-i-create-a-dev-null-like-blackhole-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
This isn't supported out-of-the-box on any unix I know, but you can do pretty much anything with FUSE. There's at least one implementation of nullfs¹, a filesystem where every file exists and behaves like /dev/null (this isn't the only implementation I've ever seen).
¹
Not to be confused with the *BSD nullfs, which is analogous to bindfs.
Fantastic - I've used this as part of an answer on SO
– Phil Lello
May 5 '11 at 21:52
1
a note to people who end up with compile errors on that program:g++ -Wall -o nullfs nullfs.c++ `pkg-config fuse --cflags --libs`worked for me.
– ixtmixilix
Mar 3 '13 at 7:11
Can you point me to other implementations? Because I can't find any
– Freedo
Aug 2 at 4:50
@Freedo I suspect many people have done it as a learning exercise and let it go unmaintained. They might not be on the web anymore.
– Gilles
Aug 2 at 6:07
add a comment |
This isn't supported out-of-the-box on any unix I know, but you can do pretty much anything with FUSE. There's at least one implementation of nullfs¹, a filesystem where every file exists and behaves like /dev/null (this isn't the only implementation I've ever seen).
¹
Not to be confused with the *BSD nullfs, which is analogous to bindfs.
Fantastic - I've used this as part of an answer on SO
– Phil Lello
May 5 '11 at 21:52
1
a note to people who end up with compile errors on that program:g++ -Wall -o nullfs nullfs.c++ `pkg-config fuse --cflags --libs`worked for me.
– ixtmixilix
Mar 3 '13 at 7:11
Can you point me to other implementations? Because I can't find any
– Freedo
Aug 2 at 4:50
@Freedo I suspect many people have done it as a learning exercise and let it go unmaintained. They might not be on the web anymore.
– Gilles
Aug 2 at 6:07
add a comment |
This isn't supported out-of-the-box on any unix I know, but you can do pretty much anything with FUSE. There's at least one implementation of nullfs¹, a filesystem where every file exists and behaves like /dev/null (this isn't the only implementation I've ever seen).
¹
Not to be confused with the *BSD nullfs, which is analogous to bindfs.
This isn't supported out-of-the-box on any unix I know, but you can do pretty much anything with FUSE. There's at least one implementation of nullfs¹, a filesystem where every file exists and behaves like /dev/null (this isn't the only implementation I've ever seen).
¹
Not to be confused with the *BSD nullfs, which is analogous to bindfs.
answered Mar 16 '11 at 21:45
GillesGilles
574k140 gold badges1184 silver badges1696 bronze badges
574k140 gold badges1184 silver badges1696 bronze badges
Fantastic - I've used this as part of an answer on SO
– Phil Lello
May 5 '11 at 21:52
1
a note to people who end up with compile errors on that program:g++ -Wall -o nullfs nullfs.c++ `pkg-config fuse --cflags --libs`worked for me.
– ixtmixilix
Mar 3 '13 at 7:11
Can you point me to other implementations? Because I can't find any
– Freedo
Aug 2 at 4:50
@Freedo I suspect many people have done it as a learning exercise and let it go unmaintained. They might not be on the web anymore.
– Gilles
Aug 2 at 6:07
add a comment |
Fantastic - I've used this as part of an answer on SO
– Phil Lello
May 5 '11 at 21:52
1
a note to people who end up with compile errors on that program:g++ -Wall -o nullfs nullfs.c++ `pkg-config fuse --cflags --libs`worked for me.
– ixtmixilix
Mar 3 '13 at 7:11
Can you point me to other implementations? Because I can't find any
– Freedo
Aug 2 at 4:50
@Freedo I suspect many people have done it as a learning exercise and let it go unmaintained. They might not be on the web anymore.
– Gilles
Aug 2 at 6:07
Fantastic - I've used this as part of an answer on SO
– Phil Lello
May 5 '11 at 21:52
Fantastic - I've used this as part of an answer on SO
– Phil Lello
May 5 '11 at 21:52
1
1
a note to people who end up with compile errors on that program:
g++ -Wall -o nullfs nullfs.c++ `pkg-config fuse --cflags --libs` worked for me.– ixtmixilix
Mar 3 '13 at 7:11
a note to people who end up with compile errors on that program:
g++ -Wall -o nullfs nullfs.c++ `pkg-config fuse --cflags --libs` worked for me.– ixtmixilix
Mar 3 '13 at 7:11
Can you point me to other implementations? Because I can't find any
– Freedo
Aug 2 at 4:50
Can you point me to other implementations? Because I can't find any
– Freedo
Aug 2 at 4:50
@Freedo I suspect many people have done it as a learning exercise and let it go unmaintained. They might not be on the web anymore.
– Gilles
Aug 2 at 6:07
@Freedo I suspect many people have done it as a learning exercise and let it go unmaintained. They might not be on the web anymore.
– Gilles
Aug 2 at 6:07
add a comment |
Another approach would be a LD_PRELOAD wrapper; basically a small shared library which is loaded before libc.so, and intercepts calls to "open" with something that checks the prospective file path and substitutes "/dev/null" if it would be in the target directory.
This has the advantage of being
(a) entirely in user-space - no kernel hacking required; and
(b) only affecting the single errant application.
A simple example is at http://www.noah.org/wiki/LD_PRELOAD_notes, but in your case you will want to intercept the "open" & "creat" system calls.
3
...assuming the application does system calls via libc, not directly viaint 0x80/syscall/sysenter/whatever else.
– Ruslan
Feb 7 '16 at 18:44
add a comment |
Another approach would be a LD_PRELOAD wrapper; basically a small shared library which is loaded before libc.so, and intercepts calls to "open" with something that checks the prospective file path and substitutes "/dev/null" if it would be in the target directory.
This has the advantage of being
(a) entirely in user-space - no kernel hacking required; and
(b) only affecting the single errant application.
A simple example is at http://www.noah.org/wiki/LD_PRELOAD_notes, but in your case you will want to intercept the "open" & "creat" system calls.
3
...assuming the application does system calls via libc, not directly viaint 0x80/syscall/sysenter/whatever else.
– Ruslan
Feb 7 '16 at 18:44
add a comment |
Another approach would be a LD_PRELOAD wrapper; basically a small shared library which is loaded before libc.so, and intercepts calls to "open" with something that checks the prospective file path and substitutes "/dev/null" if it would be in the target directory.
This has the advantage of being
(a) entirely in user-space - no kernel hacking required; and
(b) only affecting the single errant application.
A simple example is at http://www.noah.org/wiki/LD_PRELOAD_notes, but in your case you will want to intercept the "open" & "creat" system calls.
Another approach would be a LD_PRELOAD wrapper; basically a small shared library which is loaded before libc.so, and intercepts calls to "open" with something that checks the prospective file path and substitutes "/dev/null" if it would be in the target directory.
This has the advantage of being
(a) entirely in user-space - no kernel hacking required; and
(b) only affecting the single errant application.
A simple example is at http://www.noah.org/wiki/LD_PRELOAD_notes, but in your case you will want to intercept the "open" & "creat" system calls.
answered Apr 21 '13 at 1:29
Martin KealeyMartin Kealey
911 silver badge2 bronze badges
911 silver badge2 bronze badges
3
...assuming the application does system calls via libc, not directly viaint 0x80/syscall/sysenter/whatever else.
– Ruslan
Feb 7 '16 at 18:44
add a comment |
3
...assuming the application does system calls via libc, not directly viaint 0x80/syscall/sysenter/whatever else.
– Ruslan
Feb 7 '16 at 18:44
3
3
...assuming the application does system calls via libc, not directly via
int 0x80/syscall/sysenter/whatever else.– Ruslan
Feb 7 '16 at 18:44
...assuming the application does system calls via libc, not directly via
int 0x80/syscall/sysenter/whatever else.– Ruslan
Feb 7 '16 at 18:44
add a comment |
If the program is so stupid to not let you switch those logs off, may be it also doesn't check for errors after opening a log file? I'd try mounting some dummy read-only file system (e.g. using mount -o loop.)
this approach doesn't work unfortunately. The application dies if it can't write to this file.
– dogbane
Mar 16 '11 at 12:22
add a comment |
If the program is so stupid to not let you switch those logs off, may be it also doesn't check for errors after opening a log file? I'd try mounting some dummy read-only file system (e.g. using mount -o loop.)
this approach doesn't work unfortunately. The application dies if it can't write to this file.
– dogbane
Mar 16 '11 at 12:22
add a comment |
If the program is so stupid to not let you switch those logs off, may be it also doesn't check for errors after opening a log file? I'd try mounting some dummy read-only file system (e.g. using mount -o loop.)
If the program is so stupid to not let you switch those logs off, may be it also doesn't check for errors after opening a log file? I'd try mounting some dummy read-only file system (e.g. using mount -o loop.)
answered Mar 16 '11 at 9:56
alexalex
4,5494 gold badges20 silver badges29 bronze badges
4,5494 gold badges20 silver badges29 bronze badges
this approach doesn't work unfortunately. The application dies if it can't write to this file.
– dogbane
Mar 16 '11 at 12:22
add a comment |
this approach doesn't work unfortunately. The application dies if it can't write to this file.
– dogbane
Mar 16 '11 at 12:22
this approach doesn't work unfortunately. The application dies if it can't write to this file.
– dogbane
Mar 16 '11 at 12:22
this approach doesn't work unfortunately. The application dies if it can't write to this file.
– dogbane
Mar 16 '11 at 12:22
add a comment |
You say that removing the files periodically with a script isn't fast enough. Could you live with a trigger that deletes a temporary file any time your application finishes writing and closes it? If so, you might make use of the "inotify" API.
(See http://en.wikipedia.org/wiki/Inotify and https://github.com/rvoicilas/inotify-tools/wiki/)
1
On many systems, deleting a file that a process has open removes its directory entry, but the file itself stays on disk until it is closed by the last process using it. Processes might write files and then seek to the beginning and read them back, and so the OS can't just throw the data away.
– interfect
Apr 18 '17 at 21:58
add a comment |
You say that removing the files periodically with a script isn't fast enough. Could you live with a trigger that deletes a temporary file any time your application finishes writing and closes it? If so, you might make use of the "inotify" API.
(See http://en.wikipedia.org/wiki/Inotify and https://github.com/rvoicilas/inotify-tools/wiki/)
1
On many systems, deleting a file that a process has open removes its directory entry, but the file itself stays on disk until it is closed by the last process using it. Processes might write files and then seek to the beginning and read them back, and so the OS can't just throw the data away.
– interfect
Apr 18 '17 at 21:58
add a comment |
You say that removing the files periodically with a script isn't fast enough. Could you live with a trigger that deletes a temporary file any time your application finishes writing and closes it? If so, you might make use of the "inotify" API.
(See http://en.wikipedia.org/wiki/Inotify and https://github.com/rvoicilas/inotify-tools/wiki/)
You say that removing the files periodically with a script isn't fast enough. Could you live with a trigger that deletes a temporary file any time your application finishes writing and closes it? If so, you might make use of the "inotify" API.
(See http://en.wikipedia.org/wiki/Inotify and https://github.com/rvoicilas/inotify-tools/wiki/)
answered Mar 16 '11 at 20:17
Elliot NelsonElliot Nelson
1114 bronze badges
1114 bronze badges
1
On many systems, deleting a file that a process has open removes its directory entry, but the file itself stays on disk until it is closed by the last process using it. Processes might write files and then seek to the beginning and read them back, and so the OS can't just throw the data away.
– interfect
Apr 18 '17 at 21:58
add a comment |
1
On many systems, deleting a file that a process has open removes its directory entry, but the file itself stays on disk until it is closed by the last process using it. Processes might write files and then seek to the beginning and read them back, and so the OS can't just throw the data away.
– interfect
Apr 18 '17 at 21:58
1
1
On many systems, deleting a file that a process has open removes its directory entry, but the file itself stays on disk until it is closed by the last process using it. Processes might write files and then seek to the beginning and read them back, and so the OS can't just throw the data away.
– interfect
Apr 18 '17 at 21:58
On many systems, deleting a file that a process has open removes its directory entry, but the file itself stays on disk until it is closed by the last process using it. Processes might write files and then seek to the beginning and read them back, and so the OS can't just throw the data away.
– interfect
Apr 18 '17 at 21:58
add a comment |
i have created a kernel module based on the ramfs example in the linux kernel,
it is basically a blackhole filesystem called nullfsvfs. The FUSE system implementation needs to copy data from user to kernelspace and is quite slow, compared to a straight implementation as kernel module. See:
https://github.com/abbbi/nullfsvfs
New contributor
michael is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
i have created a kernel module based on the ramfs example in the linux kernel,
it is basically a blackhole filesystem called nullfsvfs. The FUSE system implementation needs to copy data from user to kernelspace and is quite slow, compared to a straight implementation as kernel module. See:
https://github.com/abbbi/nullfsvfs
New contributor
michael is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
i have created a kernel module based on the ramfs example in the linux kernel,
it is basically a blackhole filesystem called nullfsvfs. The FUSE system implementation needs to copy data from user to kernelspace and is quite slow, compared to a straight implementation as kernel module. See:
https://github.com/abbbi/nullfsvfs
New contributor
michael is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
i have created a kernel module based on the ramfs example in the linux kernel,
it is basically a blackhole filesystem called nullfsvfs. The FUSE system implementation needs to copy data from user to kernelspace and is quite slow, compared to a straight implementation as kernel module. See:
https://github.com/abbbi/nullfsvfs
New contributor
michael is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
michael is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 3 hours ago
michaelmichael
1
1
New contributor
michael is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
michael is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
Just symlink that directory to /dev/null
rm -rf ~/.logs
ln -s /dev/null ~/.logs
/dev/null, doesn't have to be a directory. If the program tries writing to ~/.logs/log1.dump, it still goes right into /dev/null.
I do this for Google Chrome's cache because after a while it gets so big that Chrome will take minutes to start.
3
This wouldn't work because symlinks are files, not directories. Tryingecho hello > ~/.logs/log1.dumpgives~/.logs/log1.dump: Not a directory. However,echo hello > ~/.logsworks because .logs is a file.
– dogbane
Mar 16 '11 at 13:25
2
You must be kidding us.$ ln -s /dev/null dev-null; touch dev-null/zzzgives metouch: cannot touch 'dev-null/zzz': Not a directory
– alex
Mar 16 '11 at 13:28
1
Like I said, it works for Chrome. It prevents it from writing into the cache. If it causes the asker's program to crash, then obviously it doesn't check if file pointers are NULL.
– jonescb
Mar 16 '11 at 13:54
6
It probably means that Chrome skips writing if there is an error opening the file. You could achieve the same effect by removing write permission from the dump file or the directory its writing in.
– KeithB
Mar 16 '11 at 14:04
True, changing the permissions of the directory would probably make more sense.
– jonescb
Mar 16 '11 at 14:53
add a comment |
Just symlink that directory to /dev/null
rm -rf ~/.logs
ln -s /dev/null ~/.logs
/dev/null, doesn't have to be a directory. If the program tries writing to ~/.logs/log1.dump, it still goes right into /dev/null.
I do this for Google Chrome's cache because after a while it gets so big that Chrome will take minutes to start.
3
This wouldn't work because symlinks are files, not directories. Tryingecho hello > ~/.logs/log1.dumpgives~/.logs/log1.dump: Not a directory. However,echo hello > ~/.logsworks because .logs is a file.
– dogbane
Mar 16 '11 at 13:25
2
You must be kidding us.$ ln -s /dev/null dev-null; touch dev-null/zzzgives metouch: cannot touch 'dev-null/zzz': Not a directory
– alex
Mar 16 '11 at 13:28
1
Like I said, it works for Chrome. It prevents it from writing into the cache. If it causes the asker's program to crash, then obviously it doesn't check if file pointers are NULL.
– jonescb
Mar 16 '11 at 13:54
6
It probably means that Chrome skips writing if there is an error opening the file. You could achieve the same effect by removing write permission from the dump file or the directory its writing in.
– KeithB
Mar 16 '11 at 14:04
True, changing the permissions of the directory would probably make more sense.
– jonescb
Mar 16 '11 at 14:53
add a comment |
Just symlink that directory to /dev/null
rm -rf ~/.logs
ln -s /dev/null ~/.logs
/dev/null, doesn't have to be a directory. If the program tries writing to ~/.logs/log1.dump, it still goes right into /dev/null.
I do this for Google Chrome's cache because after a while it gets so big that Chrome will take minutes to start.
Just symlink that directory to /dev/null
rm -rf ~/.logs
ln -s /dev/null ~/.logs
/dev/null, doesn't have to be a directory. If the program tries writing to ~/.logs/log1.dump, it still goes right into /dev/null.
I do this for Google Chrome's cache because after a while it gets so big that Chrome will take minutes to start.
answered Mar 16 '11 at 12:54
jonescbjonescb
1,6011 gold badge12 silver badges20 bronze badges
1,6011 gold badge12 silver badges20 bronze badges
3
This wouldn't work because symlinks are files, not directories. Tryingecho hello > ~/.logs/log1.dumpgives~/.logs/log1.dump: Not a directory. However,echo hello > ~/.logsworks because .logs is a file.
– dogbane
Mar 16 '11 at 13:25
2
You must be kidding us.$ ln -s /dev/null dev-null; touch dev-null/zzzgives metouch: cannot touch 'dev-null/zzz': Not a directory
– alex
Mar 16 '11 at 13:28
1
Like I said, it works for Chrome. It prevents it from writing into the cache. If it causes the asker's program to crash, then obviously it doesn't check if file pointers are NULL.
– jonescb
Mar 16 '11 at 13:54
6
It probably means that Chrome skips writing if there is an error opening the file. You could achieve the same effect by removing write permission from the dump file or the directory its writing in.
– KeithB
Mar 16 '11 at 14:04
True, changing the permissions of the directory would probably make more sense.
– jonescb
Mar 16 '11 at 14:53
add a comment |
3
This wouldn't work because symlinks are files, not directories. Tryingecho hello > ~/.logs/log1.dumpgives~/.logs/log1.dump: Not a directory. However,echo hello > ~/.logsworks because .logs is a file.
– dogbane
Mar 16 '11 at 13:25
2
You must be kidding us.$ ln -s /dev/null dev-null; touch dev-null/zzzgives metouch: cannot touch 'dev-null/zzz': Not a directory
– alex
Mar 16 '11 at 13:28
1
Like I said, it works for Chrome. It prevents it from writing into the cache. If it causes the asker's program to crash, then obviously it doesn't check if file pointers are NULL.
– jonescb
Mar 16 '11 at 13:54
6
It probably means that Chrome skips writing if there is an error opening the file. You could achieve the same effect by removing write permission from the dump file or the directory its writing in.
– KeithB
Mar 16 '11 at 14:04
True, changing the permissions of the directory would probably make more sense.
– jonescb
Mar 16 '11 at 14:53
3
3
This wouldn't work because symlinks are files, not directories. Trying
echo hello > ~/.logs/log1.dump gives ~/.logs/log1.dump: Not a directory. However, echo hello > ~/.logs works because .logs is a file.– dogbane
Mar 16 '11 at 13:25
This wouldn't work because symlinks are files, not directories. Trying
echo hello > ~/.logs/log1.dump gives ~/.logs/log1.dump: Not a directory. However, echo hello > ~/.logs works because .logs is a file.– dogbane
Mar 16 '11 at 13:25
2
2
You must be kidding us.
$ ln -s /dev/null dev-null; touch dev-null/zzz gives me touch: cannot touch 'dev-null/zzz': Not a directory– alex
Mar 16 '11 at 13:28
You must be kidding us.
$ ln -s /dev/null dev-null; touch dev-null/zzz gives me touch: cannot touch 'dev-null/zzz': Not a directory– alex
Mar 16 '11 at 13:28
1
1
Like I said, it works for Chrome. It prevents it from writing into the cache. If it causes the asker's program to crash, then obviously it doesn't check if file pointers are NULL.
– jonescb
Mar 16 '11 at 13:54
Like I said, it works for Chrome. It prevents it from writing into the cache. If it causes the asker's program to crash, then obviously it doesn't check if file pointers are NULL.
– jonescb
Mar 16 '11 at 13:54
6
6
It probably means that Chrome skips writing if there is an error opening the file. You could achieve the same effect by removing write permission from the dump file or the directory its writing in.
– KeithB
Mar 16 '11 at 14:04
It probably means that Chrome skips writing if there is an error opening the file. You could achieve the same effect by removing write permission from the dump file or the directory its writing in.
– KeithB
Mar 16 '11 at 14:04
True, changing the permissions of the directory would probably make more sense.
– jonescb
Mar 16 '11 at 14:53
True, changing the permissions of the directory would probably make more sense.
– jonescb
Mar 16 '11 at 14:53
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f9332%2fhow-can-i-create-a-dev-null-like-blackhole-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It sounds like FUSE might be an option: kerneltrap.org/mailarchive/linux-kernel/2008/2/15/868564/thread
– Stefan Lasiewski
Mar 16 '11 at 20:32
i just asked myself the same question, and used the same name for the directory i failed to create.
– ixtmixilix
Mar 3 '13 at 6:56