The tag has no wiki summary.

learn more… | top users | synonyms

18
votes
4answers
6k views

Clone whole partition or hard drive to a sparse file

I like to clone a whole partition or a whole hard drive onto a larger external disk but like to create a sparse file. I often use dd for cloning, but it doesn't support sparse files. As a workaround I ...
16
votes
3answers
1k views

How can you trim files using the command line?

What is the console equivalent of the following Python code: target = file("disk", "w") # create a file target.seek(2*1024*1024*1024) # skip to 2 GB target.write("\0") target.close() Maybe some ...
11
votes
4answers
2k views

Creating an arbitrarily large “fake” file

I would like to create a special file similar to /dev/null or /dev/random, where the file doesn't actually exist but you can read from it all the same, except that I could actually set a cap on the ...
8
votes
3answers
12k views

How to make ext4 filesystem sparse?

I am using Linux as guest OS in VirtualBox. I deleted huge number of files from its filesystem. Now i want to shrink the filesystem image file (vdi). The shrinking works by compressing filesystem ...
8
votes
2answers
1k views

Detailed sparse file information on Linux

I have a sparse file, in which only some blocks are allocated: ~% du -h --apparent-size example 100K example ~% du -h example 52K example I would like to know which blocks of the file are ...
7
votes
4answers
798 views

Can a file that was originally sparse and expanded be made re-sparse

I know that copying or transferring what was originally a sparse file without using a utility that understands sparse files will cause the 'holes' to be filled out. Is there a method or utility to ...
7
votes
1answer
51 views

How to display the non-sparse parts of a sparse file?

Imagine a file created with: truncate -s1T file echo test >> file truncate -s2T file I now have a 2 tebibyte file (that occupies 4kiB on disk), with "test\n" written in the middle. How would ...
6
votes
2answers
492 views

How can I speed up operations on sparse files with tar, gzip, rsync?

I have a sparse file. (du -h reports 3G and du -h --apparent-size reports 100G.) So far, so good. Now, when I want to compress the file using tar or send it over the network using rsync, it will ...
5
votes
1answer
1k views

Fragmentation and ext4

Suppose I have a sparse file F on a Linux ext4 filesystem, and process P1 is writing to a disjoint 50% subset of F while P2 writes to the other 50% of F. I would like to minimize fragmentation while ...
4
votes
1answer
194 views

zerofree verbose returns what?

zerofree -v /dev/sda1 returned 123642/1860888/3327744. The man page does not explain what those numbers are: http://manpages.ubuntu.com/manpages/natty/man8/zerofree.8.html I found some code on ...
4
votes
1answer
1k views

Sparse files/file holes and unexpected block size

For my own learning, I've been playing around with creating files with file holes. I created a util that simply reads from stdin and writes to a file, but before writing to the file, it uses lseek to ...
4
votes
1answer
53 views

Linux: How to calculate/find the slackspace of a file?

How would I go about finding the slackspace of a file, for instance. fls -o 63 /images/diskimg.dd istat -o 63 /images/diskimg.dd 31 icat -o 63 /images/diskimg.dd | xxd | less In which of these ...
3
votes
3answers
459 views

from a sparse file to a block device over the network

If I have a sparse file representing a block device, then how can I efficiently restore the file over a network? Ideally, I'd use rsync -S host:file /dev/sdb, but rsync won't write to block devices. ...
3
votes
3answers
942 views

Is creating a sparse image using dd appropriate for backup/restore from a RAID?

I have two non-networked servers, each with 1.2TB of storage in a RAID5 config on an LSI MegaRaid 9240-8i controller. I have been trying without success to get Symantec Ghost to image one machine to ...
2
votes
1answer
49 views

Looking for a “undo” for file with holes (GNU)

Linux supports sparse files aka 'file with holes' Note following commands alias mystat='stat -c "%n: %B*%b blocks %s bytes"' dd if=/dev/zero bs=1024k seek=4096 count=0 of=file-with-holes ls -l ...
2
votes
1answer
469 views

Can QEMU/KVM+OCFS2 be configured to punch holes in sparse image files when files are deleted in the guest?

I'm using sparse raw image files for guest VMs and OCFS2 on the host (local-only, not clustered) for the reflink feature. I understand from Googling around that OCFS2 is one of the filesystems that ...
2
votes
1answer
2k views

What is the interaction of the rsync --size-only and --sparse options?

If I use rsync with the --size-only and --sparse options together, if a file already exists at the destination as a full file (otherwise the same) it's not overwritten. If I omit the --size-only ...
1
vote
1answer
406 views

Ext4 exhibits unexpected write latency variance vs. ext2

I have a latency sensitive application running on an embedded system, and I'm seeing some discrepancy between writing to a ext4 partition and an ext2 partition on the same physical device. ...
1
vote
1answer
256 views

Stripping null byte blocks with a sparse file?

I've created a sparse file with dd. How do I copy contents of another file there, leaving all the zero blocks unallocated?
1
vote
1answer
221 views

What parts of the filesystem to tmpfs/squashfs/sparseimage for USB live system

I want to create a live system on a USB key / SDCard with Linux Mint 14 (KDE or Debian Edition) that stores data persistently. The USB key needs to have at least one fat32 partition. As storage for ...