My Profile

Keep Up to Date:
Blog RSS
Blog
Forum RSS
Forum
Post New Topic Post Reply
Posted 7 Months, 2 Weeks ago
fidofido
Senior Boarder
Posts: 78
graphgraph
User Offline
 
Hi to all

I would like to save 20% space in our filesystem by making all files that are by nature sparse (but do hold the full disk-space, I 'd call then 'sparse-able' but not sparse yet), truly sparse in the sense that they will take much less space (For example du filename and ls -l filename would show different numbers after you correct for du printing in KB and ls -l in Bytes). Is there a tool that would find which files are 'sparse-able' and then make them sparse by for example using cp
The administrator has disabled public write access.
Posted 7 Months, 2 Weeks ago
biddy
Senior Boarder
Posts: 68
graphgraph
User Offline
 
The best way is to *write the files sparse to begin with.* Let us imagine a primitive database program.

fd = open(filename, O_RDWR); write(fd, block0, blocksize); lseek(fd, blocksize * N, SEEK_SET); write(fd, blockN, blocksize);

etc.

This would write two blocks (not to be confused with the blocksize of the file system, though it might make sense to make them the same). In a real program, you would check for error returns, etc.

My guess is that cp
The administrator has disabled public write access.
Posted 7 Months, 2 Weeks ago
newsgirl
Expert Boarder
Posts: 81
graphgraph
User Offline
 
Thanks to both tony and Jean-David for their replies Some comments:

- I am not the creator of the files
The administrator has disabled public write access.
Posted 7 Months, 2 Weeks ago
skyhog
Senior Boarder
Posts: 57
graphgraph
User Offline
 
Another thing I would consider is some kind of on-the-fly compression method.

This will likely save quite a bit of space if you have large areas of same-character (whether it's zeros or anything else).

In the case of images, I recall that targa file format allows for 24 bit encoding with lossless lzh compression. Or you could use a script kind of like this (for actually any type of pattern-laden data):
The administrator has disabled public write access.
Posted 7 Months, 2 Weeks ago
Hdkujrox
Senior Boarder
Posts: 68
graphgraph
User Offline
 
Maybe I have a newer version of cp than yours. It has
The administrator has disabled public write access.
Posted 7 Months, 2 Weeks ago
razvlerrr
Senior Boarder
Posts: 70
graphgraph
User Offline
 
Another thought is that if you compress such a file and then uncompress it using a 'sparsity-aware' program, then the sparse portions should hopefully be treated as such.
The administrator has disabled public write access.
 
Copyright © 2006 - Dec 2008 My Linux Gang