butchie3980 has asked for the wisdom of the Perl Monks concerning the following question:

Not sure how to describe this with the right terminology, but I'll give it a crack. I want to grab some disk images (taken with dd from a raid5 array) and re-assemble them. The idea is that I slap the files back together and then offer the data as a device, like /dev/virtualraid or something like it. This way I can then run utils on the virtually re-assembled data without having to dump the big lump of data back on to the hard drive. is there a way to set that up in perl? what's it called? a virtual inode? virtual device? virtual filesystem? Thanks...BW

Replies are listed 'Best First'.
Re: virtual filesystem thingy
by Corion (Patriarch) on Mar 03, 2011 at 11:53 UTC

    I'm not sure that this is conveniently possible without concatenating the disk images back together to a whole. Fuse allows you to export your own filesystem to Linux, but it does so at a much higher level.

    If you can find out how to create a device (driver) on your OS and have that driver call Perl for the operations, then supplying the appropriate data from the raid files is easy.

    If you are able to reconstruct the disk image as one single file, by copying the appropriate stripes from the disk images, then you don't need Perl, as you can mount a file (at least under Linux) just like a real disk using the "loopback" device.

Re: virtual filesystem thingy
by JavaFan (Canon) on Mar 03, 2011 at 12:46 UTC
    I want to grab some disk images (taken with dd from a raid5 array) and re-assemble them. The idea is that I slap the files back together and then offer the data as a device, like /dev/virtualraid or something like it.
    I don't think you can (easily) do that. Raid 5 isn't just simple striping - and it happens on a pretty low level. Assuming we aren't talking about hardware raid 5, you'd need the meta information of your volume manager, and mimic whatever your volume manager does.
Re: virtual filesystem thingy
by salva (Canon) on Mar 03, 2011 at 13:18 UTC
Re: virtual filesystem thingy
by anonymized user 468275 (Curate) on Mar 03, 2011 at 14:10 UTC
    Disk images can be mounted. You may need to use fdisk first to find out the partition structure.

    One world, one people

      Disk images can be mounted.
      No.

      One mounts file systems. A disk image may contain a file system, but that isn't always the case. Specially not with RAID5, where the file system spans several disk images - but the file system is less than the sum of the disk images. (For instance, the sum of the disk images contain the parity bits, but the entire point is that those are invisible to the file system).