From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1PjGKQ-0003O1-GG for garchives@archives.gentoo.org; Sat, 29 Jan 2011 19:19:22 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B001CE0BAA; Sat, 29 Jan 2011 19:17:46 +0000 (UTC) Received: from dcnode-02.unlimitedmail.net (smtp.unlimitedmail.net [94.127.184.243]) by pigeon.gentoo.org (Postfix) with ESMTP id 3C602E0BAA for ; Sat, 29 Jan 2011 19:17:45 +0000 (UTC) Received: from zoot.sax (hex.aaisp.net.uk [90.155.53.9] (may be forged)) (authenticated bits=0) by dcnode-02.unlimitedmail.net (8.14.3/8.14.3) with ESMTP id p0TJHaR8024274 for ; Sat, 29 Jan 2011 20:17:36 +0100 Message-Id: <201101291917.p0TJHaR8024274@dcnode-02.unlimitedmail.net> Date: Sat, 29 Jan 2011 18:59:56 +0000 From: Etaoin Shrdlu To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Cloning a directory hierarchy, but not the content In-Reply-To: <201101291745.31007.wonko@wonkology.org> References: <201101291458.13533.wonko@wonkology.org> <201101291527.59925.wonko@wonkology.org> <201101291453.p0TErwXr001236@dcnode-02.unlimitedmail.net> <201101291745.31007.wonko@wonkology.org> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.20.1; x86_64-pc-linux-gnu) User-Agent: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SOLTECSIS-MailScanner-ID: p0TJHaR8024274 X-SOLTECSIS-MailScanner-From: shrdlu@unlimitedmail.org X-Spam-Status: No X-Archives-Salt: X-Archives-Hash: 66fb9b7642b5e48582ccef07710edae7 On Sat, 29 Jan 2011 17:45:30 +0100 Alex Schuster wrote: > Ah, now I get it. There's a -c missing after the sh command. Right, thans for spotting it. > > I should have added that, to do it safely, the target should reside > > higher than the source in the hierarchy, or it should be on a different > > filesystem and in that case -xdev should be specified to find > > (otherwise an recursive loop would result). > > Right, but not important in my case. I want to mount my backup drive to > /mnt, cd /mnt, and duplicate all stuff soemwhere else, without taking up > much space. Then I can remove the backup drive and I only have to mount > it again when I need a file's content, but not for finding out which > files there are and how much space they take. Well, the space already is > in the file created by du -m, but I'd like to directly navigate around. Oh, I see now: you want the files to *look like* the real ones (eg when doing ls -l etc.), but be sparse so they don't take up space? > Sparse files would be nice because then I do not only have the same > logical structure, the files also appear to have the same size as the > originals, instead of having a size of 0. I could navigate and explore > the directory structure with mc, and with du --apparent-size I could find > out how much space a subdirectory takes. Again, my du -m file already has > this information, but while navigating in the directory tree, being able > to use du would be nice. Ok, one way to create a sparse file of, say, 1 megabyte is using dd: # dd if=/dev/null of=sparsefile bs=1 seek=1M 0+0 records in 0+0 records out 0 bytes (0 B) copied, 2.5419e-05 s, 0.0 kB/s # ls -l sparsefile -rw-r--r-- 1 root root 1048576 Jan 29 11:57 sparsefile # du -B1 sparsefile 0 sparsefile Another way, already suggested, is by using truncate, eg # truncate -s 1M sparsefile