[NTLUG:Discuss] Software RAID using file "device"?

Robert Thompson ntlug at thorshammer.org
Sat Oct 22 17:14:23 CDT 2005


> neither mdadm nor lvm seem to be willing to work with a non-block
> device.

Have you tried a loopback device (man mount and search for loop)? You
can create a loopback mount from a file and attempt to use that.

After a quick search here are the commands you'll need:

Create a 50M file
# dd if=/dev/urandom of=/tmp/test.img bs=1M count=50

Mount the file using the loopback tools
# losetup /dev/loop0 /tmp/test.img

Create a filesystem on the device
# mkfs -t ext3 /dev/loop0

Detach the file
# losetup -d /dev/loop0

Mount the file as a device for use
# mount /tmp/test.img /mnt -o loop=/dev/loop0

Redhat should have these commands installed and the kernel is already
compiled for loopback device support. Do a man on any of the above
commands for more details.

I've never tried setting up a loopback device with another drive for
raid0 so let us know if you get it to work.

Robert Thompson


On Thu, 2005-10-20 at 19:46 -0500, Stuart Johnston wrote:
> I have a server with two partitions, / and /home (not the best setup, I 
> know).  The /home partition is coming very close to running out of disk 
> space and I am trying to figure out a way to use some of the extra space 
> on / without requiring a trip down to the data center.  This would only 
> need to be a temporary solution.
> 
> When I setup the system, I didn't worry too much about the partition 
> setup because I was using LVM, which I thought would allow me to easily 
> re-allocate the partitions as needed.  It turns out not to be quite so 
> easy since you can't generally resize an ext3 partition while it is mounted.
> 
> I was thinking about how in Linux, devices are treated like files and 
> you can often use them interchangeably.  So, if I created a file on / 
> then I could use it as a device in mdadm or lvm to combine linearly with 
> the /home partition (which can be unmounted and resized remotely). 
> Unfortuntately, neither mdadm nor lvm seem to be willing to work with a 
> non-block device.
> 
> Any suggestions on how to make this work?
> 
> thanks,
> Stuart Johnston
> 
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss
> 





More information about the Discuss mailing list