View previous topic :: View next topic |
Author |
Message |
Newbie Guest
|
Posted: Tue Jul 09, 2002 12:11 am Post subject: Gentoo Question |
|
|
What is that .keep file that shows up everywhere? |
|
Back to top |
|
|
delta407 Bodhisattva
Joined: 23 Apr 2002 Posts: 2876 Location: Chicago, IL
|
Posted: Tue Jul 09, 2002 12:13 am Post subject: |
|
|
It's a zero-byte file that forces tar to make an otherwise empty directory. If a directory is empty, tar will ignore it, and it won't get created; hence, .keep.
You can delete them if you like. _________________ I don't believe in witty sigs. |
|
Back to top |
|
|
xorbe n00b
Joined: 19 Jul 2002 Posts: 46 Location: near San Jose, CA
|
Posted: Sat Jul 20, 2002 4:33 pm Post subject: |
|
|
delta407 wrote: | It's a zero-byte file that forces tar to make an otherwise empty directory. If a directory is empty, tar will ignore it, and it won't get created; hence, .keep.
You can delete them if you like. |
I just made a bunch of empty folders, and tar cvf and tar xvf saved and restored them just fine...
so the .keep files don't really help here. Try it. Your explanation of tar just doesn't hold! |
|
Back to top |
|
|
fghellar Bodhisattva
Joined: 10 Apr 2002 Posts: 856 Location: Porto Alegre, BR
|
Posted: Sat Jul 20, 2002 5:14 pm Post subject: |
|
|
The .keep files are there to prevent portage from deleting important directories when you unmerge something that would cause those directories to be empty. _________________ | www.gentoo.org | www.tldp.org | www.google.com | |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20435
|
Posted: Thu Apr 10, 2003 4:39 am Post subject: |
|
|
Some answers from other threads: rac wrote: | They prevent emerge's autoclean option (which is enabled by default) from removing certain directories, even if they are empty. They are created by /usr/lib/portage/bin/ebuild.sh, which is part of portage, when a "keepdir" directive is included in an ebuild. |
jukka wrote: | if you remove a software package from your system (emerge -C ...), it's possible that you remove all files from a directory. in such a situation that directory is removed.
to prevent directories from beeing removed there are those "hidden" .keep files (hidden because they don't match e.g. a 'rm -f *'). they were created when you installed your system. additionally, some ebuild create such files. |
_________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
dwyrm n00b
Joined: 13 Dec 2003 Posts: 19
|
Posted: Sun Dec 28, 2003 9:16 am Post subject: "empty" .keep files |
|
|
Are they supposed to be empty? I stumbled across one that actually contained some data. |
|
Back to top |
|
|
orionrobots Apprentice
Joined: 07 Oct 2003 Posts: 289 Location: London, Uk
|
Posted: Tue Dec 30, 2003 1:56 pm Post subject: Re: "empty" .keep files |
|
|
I suspect that the .keep file will be present with keepdirs even when there are non-empty folders. Simply because unmerging the one package may remove an empty folder, which although now empty is still needed by another installed package.
dwyrm wrote: | Are they supposed to be empty? I stumbled across one that actually contained some data. |
|
|
Back to top |
|
|
dwyrm n00b
Joined: 13 Dec 2003 Posts: 19
|
Posted: Tue Dec 30, 2003 5:28 pm Post subject: communication error |
|
|
I meant that the .keep file itself had some data in it. Looked like random binary garbage, but since I don't know quite how it got there, I left it. |
|
Back to top |
|
|
tomk Bodhisattva
Joined: 23 Sep 2003 Posts: 7221 Location: Sat in front of my computer
|
Posted: Wed Dec 31, 2003 2:16 am Post subject: |
|
|
All the .keep files I've seen have been empty, but I guess it doesn't matter as either way the file exists. _________________ Search | Read | Answer | Report | Strip |
|
Back to top |
|
|
dwyrm n00b
Joined: 13 Dec 2003 Posts: 19
|
Posted: Wed Dec 31, 2003 4:28 am Post subject: it bugs me anyway |
|
|
tomk wrote: | ...it doesn't matter as either way the file exists. |
True, the .keep file will fill its function whether it's empty or it contains the entire works of Shakespere in the original Klingon. I just want to know whether something is using the .keep file in question for, perhaps, metadata, or if it's just some random fluke. I obviously don't care enough to troubleshoot it, but still... |
|
Back to top |
|
|
orionrobots Apprentice
Joined: 07 Oct 2003 Posts: 289 Location: London, Uk
|
Posted: Wed Dec 31, 2003 4:37 pm Post subject: Re: it bugs me anyway |
|
|
You could always try and use a sacrificial installation of some package to find out- and let us know what happened.. Do something sensible like hide the original .keep under temp, with its full path as underscores or something... Then add a new zero length .keep file in its place... Then try do an emerge -u or something that would definately affect some files in the given folder...
And before I forget - post the results here...
dwyrm wrote: | I just want to know whether something is using the .keep file in question for, perhaps, metadata, or if it's just some random fluke. I obviously don't care enough to troubleshoot it, but still... |
|
|
Back to top |
|
|
linux_girl Apprentice
Joined: 12 Sep 2003 Posts: 287
|
Posted: Thu Jan 01, 2004 5:30 pm Post subject: |
|
|
.keep seem to be kernel stuff for fs . or to marke deadenddirs or sometin
or maybe its a tar trick to be able to creat dirs even empty one
eg:
/boot/.keep _________________
Last edited by linux_girl on Tue Jun 29, 2004 11:42 pm; edited 1 time in total |
|
Back to top |
|
|
kezzla Apprentice
Joined: 21 Aug 2003 Posts: 253 Location: Austin, TX
|
Posted: Wed May 05, 2004 12:45 am Post subject: |
|
|
.keep = tehsuX
# cat /usr/local/bin/rmkeep
#!/bin/bash
for i in `find / -name .keep`; do rm $i; done |
|
Back to top |
|
|
linux_girl Apprentice
Joined: 12 Sep 2003 Posts: 287
|
Posted: Wed May 05, 2004 12:51 am Post subject: |
|
|
kezzla wrote: | .keep = tehsuX
# cat /usr/local/bin/rmkeep
#!/bin/bash
for i in `find / -name .keep`; do rm $i; done |
i think it was in portage setup tarball to make sure tar extract some empty dir. not sure how tar handle empty dir _________________ |
|
Back to top |
|
|
teknomage1 Veteran
Joined: 05 Aug 2003 Posts: 1239 Location: Los Angeles, CA
|
Posted: Wed May 05, 2004 12:51 am Post subject: |
|
|
What's the point of nuking a 0 byte file? |
|
Back to top |
|
|
kezzla Apprentice
Joined: 21 Aug 2003 Posts: 253 Location: Austin, TX
|
Posted: Wed May 05, 2004 1:29 am Post subject: |
|
|
So I don't have to see junk files all over my filesystem !
|
|
Back to top |
|
|
sn4ip3r Guru
Joined: 14 Dec 2002 Posts: 325 Location: Tallinn, Estonia
|
Posted: Wed May 05, 2004 1:46 am Post subject: |
|
|
kezzla wrote: | So I don't have to see junk files all over my filesystem !
|
Removing .keep files will make "qpkg -c" report them as missing, thus removing junk from the filesystem will create more junk in other places:P |
|
Back to top |
|
|
teknomage1 Veteran
Joined: 05 Aug 2003 Posts: 1239 Location: Los Angeles, CA
|
Posted: Wed May 05, 2004 2:03 am Post subject: |
|
|
don't use ls -a and they won't show up |
|
Back to top |
|
|
kezzla Apprentice
Joined: 21 Aug 2003 Posts: 253 Location: Austin, TX
|
Posted: Wed May 05, 2004 4:18 am Post subject: |
|
|
Weird...I've been removing them for almost a year now via cron job that runs nightly...never had any problems ? |
|
Back to top |
|
|
dabicho n00b
Joined: 28 Mar 2004 Posts: 28 Location: México
|
Posted: Wed Oct 20, 2004 4:35 pm Post subject: |
|
|
teknomage1 wrote: | What's the point of nuking a 0 byte file? |
A 0 bytes file takes an entry in the inodes table of your file system, and also is asigned one block, whose size demends on what you set it when you created the filesystem.
i.e. my reiserfs has a blocksize of 4kb, so each .keep file takes 4kb plus an entry in the inode table.
fortunatelly enough there are not as many .keep files to worry me
locate .keep|wc -l
tells me I have 186 .keep files (might be actually more or less though, but its a fast aproximation)
So in all, its taking up less than a mb off of my ~20gb partition.
So there is not much to worry about, space wise. But if there were too many... |
|
Back to top |
|
|
kezzla Apprentice
Joined: 21 Aug 2003 Posts: 253 Location: Austin, TX
|
Posted: Thu Oct 21, 2004 6:37 am Post subject: |
|
|
wow nice .. that was ridiculously thorough dabicho...thanks for the info |
|
Back to top |
|
|
ttuttle Tux's lil' helper
Joined: 03 Oct 2004 Posts: 131
|
Posted: Tue Dec 14, 2004 8:34 pm Post subject: |
|
|
dabicho wrote: | i.e. my reiserfs has a blocksize of 4kb, so each .keep file takes 4kb plus an entry in the inode table. |
Um... unless you use "notail" in your fstab, reiserfs will pack multiple small files into one block and put tiny files in the slack space of the last block of larger files. Blocks become simply an addressing system rather than the way space is partitioned. |
|
Back to top |
|
|
skill n00b
Joined: 15 Apr 2004 Posts: 9
|
Posted: Tue Dec 28, 2004 12:41 am Post subject: |
|
|
kezzla wrote: | Weird...I've been removing them for almost a year now via cron job that runs nightly...never had any problems ? |
For those who'd like to have one of those cronjobs and do not know how, here's a simple bash script you can add to your crontab.
Code: | cd /tmp; updatedb;locate .keep > tmp_loc_file;rm `cat tmp_loc_file`;rm tmp_loc_file; |
However, as said above, this is just for the ones that find these files annoying, the rest should just sit back and enjoy their coffee |
|
Back to top |
|
|
chemmett n00b
Joined: 26 Dec 2004 Posts: 40 Location: Maryville, TN, USA
|
Posted: Tue Dec 28, 2004 5:28 am Post subject: |
|
|
FWIW, I think those are a result of the gentoo developers using CVS. Unlike tar, CVS won't save and create empty directories. |
|
Back to top |
|
|
dbrodie n00b
Joined: 29 Dec 2004 Posts: 3
|
Posted: Sun Jan 02, 2005 1:11 pm Post subject: |
|
|
If you really want to keep them and are worried about the space, you could always hard- or soft- link all of them to a single .keep file...
Shouldn't be too difficult to do it with a simple script. |
|
Back to top |
|
|
|