[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Explain and/or demonstrate and/or point to documenation on the subject of ext3 & sparse deltas

Posted on 2006-03-19
3
Medium Priority
?
301 Views
Last Modified: 2013-12-16
Explain and/or demonstrate and/or point to documenation on the subject of ext3 & sparse deltas.
0
Comment
Question by:jerry_cornelius
1 Comment
 
LVL 1

Accepted Solution

by:
wrrrx earned 1000 total points
ID: 16285877
term 'sparse files'  reffers to files that have sequences of null bytes.  Filesystems such as ext3 can recognize those files and write them in compact (sparse) mode.  Linux `cp' command has '--sparse' option explained in the man page.

So,
# create a sparse file full of zeros
$time dd if=/dev/zero bs=1024 count=$[1024*256] | cp --sparse=always /dev/stdin 256Meg.file.sparse
262144+0 records in
262144+0 records out

real    0m17.178s
user    0m2.417s
sys     0m21.810s

# create a non-sparse file full of zeros
$time dd if=/dev/zero bs=1024 count=$[1024*256] | cp --sparse=never /dev/stdin 256Meg.file.full
262144+0 records in
262144+0 records out

real    0m25.773s
user    0m1.089s
sys     0m24.785s

#copy sparse file and note time
$time cp 256Meg.file.sparse 256Meg.file.sparse2

real    0m6.832s
user    0m0.967s
sys     0m5.680s

# copy file in full
$time cp --sparse=never 256Meg.file.full 256Meg.file.full2

real    0m58.370s
user    0m0.268s
sys     0m14.488s

## note the differece: In the 1st case we have almost no disk usage as sys.time is about the same  
##  as real.time.   In the 2nd case we have disk usage.  
## PS: tests done on a kinda slow-old machine, it shoudn't take 1min to copy 256Meg

# check sizes of files
$ls -alh 256*
-rw-------    1 konstantin konstantin     256M Mar 24 17:33 256Meg.file.full
-rw-------    1 konstantin konstantin     256M Mar 24 17:35 256Meg.file.full2
-rw-------    1 konstantin konstantin     256M Mar 24 17:32 256Meg.file.sparse
-rw-------    1 konstantin konstantin     256M Mar 24 17:34 256Meg.file.sparse2

# check disk space that is actually used
$du -h 256*
257M    256Meg.file.full
257M    256Meg.file.full2
0       256Meg.file.sparse
0       256Meg.file.sparse2


Let me know if you have questions

0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question