REGISTER  


Unused Files
This thread belongs to expert.forumgeeks.net


2009-06-23 21:20 GMT   |   #1
 
I just completed an interesting exercise.

How many files do I have on my computer that I never
use?

Decided to limit the question to libs and apps and
utilities:

First, I ran this as a cronjob every two hours
for a week and made a point of doing everything,
including compiling a kernel and rebooting...

#!/bin/bash
find /bin /sbin /usr/bin /usr/sbin /usr/local/bin /lib /usr/lib /etc \
/usr/local/lib /lib/modules -type f -amin -120 >> /root/files
cat /root/files | sort -u > /root/files-tmp
mv /root/files-tmp /root/files
exit 0

This produced a long list of files I actually use.

Then I ran this script:

#!/bin/bash
find /bin /sbin /usr/bin /usr/sbin /usr/local/bin /lib /usr/lib /etc \
/usr/local/lib /lib/modules -type f | grep -f /root/files -v >> /root/revfiles
exit 0

This produced another long list, but of the files in those directories
that I _don't_ use. (It takes a _long_ time to run.)

Next, I compared the number of files in each list.

wc -l /root/files /root/revfiles

Then I totaled the sizes of the files in kb for each file,
changing the name of input file in the script below for
each run:

#!/bin/bash
total=0
while read line
do
sub=$(/bin/ls -s -k "$line" | awk '{ print $1 }')
total=$(expr $total + $sub)
echo $total
done < /root/files
exit 0

(that script fails if any of the files in the list aren't
around anymore - run /usr/bin/script to see what they are and
remove them and run it again)

Turns out that I don't use about 1/2 the files, by size
and number, in those directories!
2009-06-26 11:20 GMT   |   #2
 
So?
                       
2009-06-26 17:20 GMT   |   #3
 
Seriously?

I prefer to use the space on my disks and other storage devices,
and filesystem management system resources for useful things,
not storage of random files.

Since you don't think it matters, obviously, I will be happy
to send the files to you and you can put them on your harddrive
and all will be well.

2009-06-26 19:35 GMT   |   #4
 
So you have a 4gig hard drive? A typical modern full Linux install
uses like 4-6gig of space (unless you have gone hog wild and installed
'EVERYTHING', including ALL of the -devel packages, all possible fonts
and language support for all possible languages, written, spoken, or
used for computer programming), including the files you are not using.
Given typical modern disk drives are greater than 80 gig (it is pretty
much impossible to buy a new disk that is smaller than about 80 gig --
you have to go to eBay and buy a pulled (used) disk), this means that
the 'extra' files (the ones you haven't used [yet]) take up less than
4% of your total disk space.
2009-06-27 03:20 GMT   |   #5
 
You are assuming that everyone has 'modern' equipment or the money to
acquire it, and this is not true. There are millions of people with
older computers who would rather clean out some unused files than
buy a 'modern' harddrive. There are poor people all over the world
that don't make enough money in a year to buy a new harddrive. $2/day
is the norm for hundreds of millions of people. A billion
people do not get enough to eat. Yet with dialup connections and old
computers, shared, they can be on the Internet.

This is sound environmental practice: The industries that make this
hardware, and the industries _they_ are dependent on, are energy-intensive
and use a great deal of other resources, doing a lot of pollution and
habitat destruction. Starting with the mines and smelters, of course.

Better to delete some unused files than trash the planet.

I have an older computer and I plan on using it forever, if possible.
Just as it is. I even have a floppy drive, which I find very useful
and I know LOTS of people like me who could afford newer equipment
but prefer to maintain and sustain the old.
2009-06-27 07:00 GMT   |   #6
 
You are assuming that everyone has 'modern' equipment or the money to acquire it

Or that they're running from a hard disk at all...

Better to delete some unused files than trash the planet.

Aren't "it's cheap, just throw more resources at the problem" answers great? Smile
2009-06-27 08:15 GMT   |   #7
 
I too have an 'old' computer, but the smallest working hard drive I have
is 6gig, but it is not installed in a computer. The smallest hard
drive that is installed and working is 20gig and the smallest one that I
have in a computer I use regularly is 40gig. I have several dead 4gig
drives. Hard drives don't last forevery, unlike other components. I
might have a couple of working 18gig drives. I also have some 9gig
drives, but they are part of a 36gig RAID array.

NewEgg has 80gig drives for as little as $20US (open box laptop SATA drives).
2009-06-27 09:20 GMT   |   #8
 
My main computer has four 18 GByte hard drives for a database, and two 73
GByte hard drives for everything else. All are 10,000 rpm SCSI hard drives.

The reason I put so many small hard drives, instead of one or two large
ones, is to reduce the seek delays when running the database. If I set up
the database correctly, I tend to read or write one file on each of the four
smaller drives at a time, so I do not need to seek so much. This also
happens, to a lesser extent, on the other two drives, where I try to read
data from one drive and write to the other (at any one time).

These days I know I could buy a single drive with all that capacity, but I
could not overlap operations on a single drive, nor would I have as many
spindles for optimizing partition placement, to get better performance with
the database. I would guess that the drives average about 25% full as I do
not collect a large number of photographs, movies, etc.

I tend to keep my computers a long time. My first home computer I bought new
in 1996 and I kept it until about 2005. My second one I bought new in early
2000 and I still run it. My newest I built in early 2004 and I am not
looking at getting a newer one. I suppose when I do, it will be 64-bit, but
I cannot justify spending money on a newer machine and do not need one.

When I got rid of the oldest machine, I took the NIC out of it and use it to
this day. I donated the rest of it to someone else who thought to give it to
an impoverished friend, but that did not work out, so he took the hard
drives out of it and some of the other items (sound board, etc.) and junked
the rest.

In the new machines, I have removed the dial-up modems and the floppy
drives. The dial-up modems I no longer need, and the floppy drives I do not
use anymore. Removing the floppies removed the ribbon cables to them, and
that helped improve the ventilation in the boxes. I gave away one of the
modems, but no one wanted floppy drives.
2009-06-27 14:55 GMT   |   #9
 
So you do a limited install. Of course, that requires that you
do some work, but you'll see a reduction, somewhat, in hard drive
space used.

But be realistic. I'm using 4gigs for the installation, that's
pretty much a full install (I left off the servers), but includes
some other applications and anything used by logs and /tmp.

Meanwhile, it's a 160gig hard drive, so I've hardly lost any space
for the full install.

You can fuss over it, but at this point it's far easier to do a full
install, since then nobody has to fuss over what to install, and if they
decide to try something, it will be there waiting for them.
2009-06-27 14:55 GMT   |   #10
 
But with a decent distribution it is there waiting for them anyway in the
repositories (and with Debian a "full install" is impossible: there are
more than 20,000 packages, many mutually exclusive.)

1 2nextlast