Bloggers Wanted
We're looking for people to help with the main blog. If you are consistent, knowledgeable and you're into it, please drop me a note.
|
|
|
|
|
fidofido
Senior Boarder
Posts: 78
|
|
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. |
biddy
Senior Boarder
Posts: 68
|
|
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. |
newsgirl
Expert Boarder
Posts: 81
|
|
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. |
skyhog
Senior Boarder
Posts: 57
|
|
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. |
Hdkujrox
Senior Boarder
Posts: 68
|
|
Maybe I have a newer version of cp than yours. It has
|
|
The administrator has disabled public write access. |
razvlerrr
Senior Boarder
Posts: 70
|
|
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. |
|
|
|