From mboxrd@z Thu Jan 1 00:00:00 1970 From: Valerie Aurora Subject: Re: Union mount of block devices? Date: Mon, 16 Nov 2009 16:16:36 -0500 Message-ID: <20091116211636.GC13403@shell> References: <9cdbb57f0911130528r3504efe2y55eb2bb4ab748568@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Andrea Gelmini Return-path: Received: from mx1.redhat.com ([209.132.183.28]:28400 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754165AbZKPVQc (ORCPT ); Mon, 16 Nov 2009 16:16:32 -0500 Content-Disposition: inline In-Reply-To: <9cdbb57f0911130528r3504efe2y55eb2bb4ab748568@mail.gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Nov 13, 2009 at 02:28:42PM +0100, Andrea Gelmini wrote: > Hi all, > sorry to bother the ml but I'm not able to find the answer via Google. > Quick answer: is it possibile to stack block devices as union > mount? Something like /dev/sdb1 (ro) below /dev/sdc1 (rw)? > > Long story... > I've got a partition with the begin of the journal over a few bad > blocks (by the way, it's NTFS but it doesn't matter), so it is not > possible to fix/replay journal, and so on. > I can dd/dd_rescue the partition to file/partition and fix/recover > all, but I just need to suck some files, so it would be a lot > easier/quicker > to stack a good partition (rw) over the bad one (ro). The phrase "union mount" caught my eye, but it's not what you want. :) Union mounts merge file systems at the namespace level, not the block or byte level of individual files. You can try something like this to get what you describe above: * Create a file big enough to cover the bad blocks * Turn it into a loop device * Create a loop device out of the good portion of your original block device using the "-o " argument to losetup * Use md or whatever to concatenate the two together There will be annoying issues with headers and alignment. If you can find a userspace recovery tool, you'll probably be a lot better off. -VAL