Jump to content

Cleaning Junk/Data Loss


Guest beta
 Share

Recommended Posts

Hi guys. :D

 

 

Im a recent (about 8 months) linux user (My system is Mandriva 2005LE and im the only user) who moved from windows after years of use (like many others :thumbs: ). And as many others we like to keep our computers clean and free of uneeded stuff, So in windows you get rid of temp files, mozilla cache, unused/old/invalid keys at registry, swap space files created by some programs, etc.

 

First Question:

 

* How can i achieve the same scenario in linux?

* What files can/must/could be deleted?

* Is there a way to erase old messges from the always growing /var/log/messages file?

 

 

I have always been concern about stability and system/software crashes, recently i read a paper about linux file system and its way of Storing things, if im not wrong the main concept its "Fill buffers in memory first then write to disk" if that its true a power failure or sudden shutdown could lead to data loss :unsure: ?? cause things in memory arent writed to disk yet.

 

Second Question:

 

* Its there a way to avoid data loss under that conditions?

* Can we force the system to do instant write-to-disk?

 

 

Thats all guys, thx for reading and excuses if my english is bad :happy:

 

[moved from Tips & Tricks by spinynorman - welcome aboard :)]

Link to comment
Share on other sites

  * How can i achieve the same scenario in linux?

  * What files can/must/could be deleted?

  * Is there a way to erase old messges from the always growing /var/log/messages                              file?

Here's a couple ideas, but not a complete answer to your questions.

 

This is a bash shell script that will trim files in /var/log to the last 50 lines. File should be owned by root with read, write, execute permissions by root only.

 

#trim /var/log
if [ `whoami` = "root" ]; then
  echo "Trimming /var/log..."
  find /var/log -type f -exec sh -c '[[ "${1##*.}" == "gz" ]] && rm $1 || (tail -50 $1 > ${1}.tmp && cat ${1}.tmp > $1 && rm ${1}.tmp)' '{}' '{}' \;
  echo "Finished with trimming"
else
  echo "You must be root to trim logs."
fi

 

In firefox: Edit -> Preferences -> Privary

 

Clear History

Clear Download Manager History

Clear Cache

Link to comment
Share on other sites

I have always been concern about stability and system/software crashes, recently i read a paper about linux file system and its way of Storing things, if im not wrong the main concept its "Fill buffers in memory first then write to disk" if that its true a power failure or sudden shutdown could lead to data loss :unsure: ?? cause things in memory arent writed to disk yet.

 

Second Question:

 

  * Its there a way to avoid data loss under that conditions?

  * Can we force the system to do instant write-to-disk?

 

that is what journalling file systems are for. data have data (aka metadata) describing them so that in case of abrupt system failure the file modifications can be easily reconstructed by replaying the journal. the amount of data loss is going to be minimal but if that guarantee is not good enough for you then there are certain tweaks in file systems to minimize the windows of your loss.

 

instant write-to-disk? i think there are options for this but it is not recommended since it is not efficient. the reason why data is not directly written to disk is because I/O operations are costly. batching write instructios togerther is more efficient. even mission critical systems are using journaled filesystems so it should be good enough for most uses.

 

ciao!

Link to comment
Share on other sites

that is what journalling file systems are for. data have data (aka metadata) describing them so that in case of abrupt system failure the file modifications can be easily reconstructed by replaying the journal. the amount of data loss is going to be minimal but if that guarantee is not good enough for you then there are certain tweaks in file systems to minimize the windows of your loss.

 

Thx for the reply, but i got a little confused, what do you mean by "replaying the journal." ?? its something the system does after rebooting from a system crash? or its a user related task?

 

:thanks:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...