Skip to contentSkip to conversation

Using a disk image file as a device in a raid set (like a loopback device)

DISCUSSION David Greaves 2 participants 3 messages Jan 8, 2006 MD RAID

lore
Share & tools
lore
#0 lore raw

Hi

First, this is not a raid recovery problem !!!

I'm recovering a disk failure and for various reasons I've ended up with a partition that's too small to hold the file system that belongs in it.

I managed to create a second small partition on a good bit of the failing disk and use linear mode to concatenate the almost big enough partition (sdc2) with the temp partition (sdb2) to make a big enough space to ddrescue the failing data.

All is now good with 95% of data on the good disk and the small partition is holding up. However I need to get rid of it ASAP. So I dd'ed the small partition onto a good filesystem on sdc1. Now I want to:

mdadm -B /dev/md0 -l linear -n2 /dev/sdc2 /space/sdb2.dd_image

but of course mdadm correctly complains that /space/sdb2.dd_image isn't a block device.

Does anyone know how I can do this?

David

#1 lore raw
Quoted 7 lines · David Greaves

mdadm -B /dev/md0 -l linear -n2 /dev/sdc2 /space/sdb2.dd_image

but of course mdadm correctly complains that /space/sdb2.dd_image isn't a block device.

Does anyone know how I can do this?

use the loopback device
man losetup

Good luck :)
Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
#2 lore raw
In reply to David Greaves

doh!

I'm so used to doing mount -oloop that I forgot how much it does for you :)

losetup /dev/loop0 /space/sdb2.dd_image mdadm -B /dev/md0 -l linear -n2 /dev/sdc2 /dev/loop0

works fine.

Sorry for the noise

David

Quoted 29 lines · David Greaves

Hi

First, this is not a raid recovery problem !!!

I'm recovering a disk failure and for various reasons I've ended up with a partition that's too small to hold the file system that belongs in it.

I managed to create a second small partition on a good bit of the failing disk and use linear mode to concatenate the almost big enough partition (sdc2) with the temp partition (sdb2) to make a big enough space to ddrescue the failing data.

All is now good with 95% of data on the good disk and the small partition is holding up. However I need to get rid of it ASAP. So I dd'ed the small partition onto a good filesystem on sdc1. Now I want to:

mdadm -B /dev/md0 -l linear -n2 /dev/sdc2 /space/sdb2.dd_image

but of course mdadm correctly complains that /space/sdb2.dd_image isn't a block device.

Does anyone know how I can do this?

David