2003-07-15 08:31:10

by Dimitry V. Ketov

[permalink] [raw]
Subject: Partitioned loop device..

Hello,
Is there any (un)official patch for current stable (or
development) kernel that makes loop device partitioned? I found one on
the ftp://ftp.hq.nasa.gov/pub/ig/ccd/enhanced_loopback/ (it contains
port of Scyld's partition enhancements), but it seems still needs a fix.
In general I plan to use partitioned loop device to simulate real disks
in linux labs, possibly with a help from Stephen Tweedie's testdrive
fault simulator. I just wonder if partitionable/faultable loop device
planned in the future official kernels, or it will be better to write a
separate 'simulated disk' driver???

Thanks in advance,
Dimitry.


2003-07-15 14:55:12

by Kevin Corry

[permalink] [raw]
Subject: Re: Partitioned loop device..

On Tuesday 15 July 2003 03:46, Dimitry V. Ketov wrote:
> Hello,
> Is there any (un)official patch for current stable (or
> development) kernel that makes loop device partitioned? I found one on
> the ftp://ftp.hq.nasa.gov/pub/ig/ccd/enhanced_loopback/ (it contains
> port of Scyld's partition enhancements), but it seems still needs a fix.
> In general I plan to use partitioned loop device to simulate real disks
> in linux labs, possibly with a help from Stephen Tweedie's testdrive
> fault simulator. I just wonder if partitionable/faultable loop device
> planned in the future official kernels, or it will be better to write a
> separate 'simulated disk' driver???
>
> Thanks in advance,
> Dimitry.

You can already use Device-Mapper to create "partitions" on your loop devices,
so there's not much of a reason to add partitioning support to the loop
driver itself. There are a variety of tools you can use to set them up: EVMS,
LVM2, dmsetup, and I think there is/was a simple partitioning tool that uses
DM (dmpartx?).

--
Kevin Corry
[email protected]
http://evms.sourceforge.net/

2003-07-15 15:38:04

by Josh Litherland

[permalink] [raw]
Subject: Re: Partitioned loop device..

In article <[email protected]> you wrote:

> so there's not much of a reason to add partitioning support to the loop
> driver itself.

Working with sector images of hard drives? I use Linux for data
recovery jobs and it would be very helpful to me to be able to look at
DOS partitions inside a loopback device. As it is I must chunk it up
into seperate files by hand.

--
Josh Litherland ([email protected])

2003-07-15 15:53:40

by Herbert Poetzl

[permalink] [raw]
Subject: Re: Partitioned loop device..

On Tue, Jul 15, 2003 at 11:53:17AM -0400, Josh Litherland wrote:
> In article <[email protected]> you wrote:
>
> > so there's not much of a reason to add partitioning support to the loop
> > driver itself.
>
> Working with sector images of hard drives? I use Linux for data
> recovery jobs and it would be very helpful to me to be able to look at
> DOS partitions inside a loopback device. As it is I must chunk it up
> into seperate files by hand.

you could also setup more than one loopback
device with different offsets into the partitions ...

for my purposes, I use the folowing script (part)

YMMV,
Herbert

---------------------

losetup /dev/loop/0 $file
sfdisk --dump /dev/loop/0 | gawk '
/^\/dev\/loop/ {
if ($6+0 > 0) {
part=substr($1,13)+0;
dev=sprintf("/dev/loop/%d", part);
printf "losetup %s -o %d /dev/loop/0\n", dev, $4*512;
printf "fsck -p -f %s\n", dev;
printf "mkdir -p /mnt/disk/part%d\n", part;
printf "mount %s /mnt/disk/part%d\n", dev, part;
}
}
' | sh




>
> --
> Josh Litherland ([email protected])
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2003-07-15 15:59:59

by Kevin Corry

[permalink] [raw]
Subject: Re: Partitioned loop device..

On Tuesday 15 July 2003 10:53, Josh Litherland wrote:
> In article <[email protected]> you wrote:
> > so there's not much of a reason to add partitioning support to the loop
> > driver itself.
>
> Working with sector images of hard drives? I use Linux for data
> recovery jobs and it would be very helpful to me to be able to look at
> DOS partitions inside a loopback device. As it is I must chunk it up
> into seperate files by hand.

Like I said, this exact thing can be done using Device-Mapper and EVMS. No
need to add new partitioning support to the loop driver.

Generally, EVMS does not look for loop devices when scanning for disks to use,
but I have a simple patch (to the EVMS tools) that will allow it to recognize
loop devices. Let me know if you're interested.

--
Kevin Corry
[email protected]
http://evms.sourceforge.net/

2003-07-15 18:16:50

by Dimitry V. Ketov

[permalink] [raw]
Subject: RE: Partitioned loop device..

> You can already use Device-Mapper to create "partitions" on
> your loop devices,
You're right but I want _partitions_ but not "partitions" ;)
It should appears like a real hardware disk, not virtual one.

> so there's not much of a reason to add partitioning support
> to the loop
> driver itself.
There is a reason for teaching my students indeed :) that is why I ask.

> There are a variety of tools you can use to
> set them up: EVMS,
> LVM2, dmsetup, and I think there is/was a simple partitioning
> tool that uses
> DM (dmpartx?).
It's just completely different topic for the teaching ;)

2003-07-15 21:03:05

by Lars Marowsky-Bree

[permalink] [raw]
Subject: Re: Partitioned loop device..

On 2003-07-15T22:32:11,
"Dimitry V. Ketov" <[email protected]> said:

> > You can already use Device-Mapper to create "partitions" on
> > your loop devices,
> You're right but I want _partitions_ but not "partitions" ;)
> It should appears like a real hardware disk, not virtual one.

There is no difference. What makes /dev/loop1a worse than /dev/hda1?
It's just block devices, that's it.

I have hopes that the entire partitioning code etc will be ripped out in
2.7 in favour of full userspace discovery + DM, and that MD will hit the
same fate...


Sincerely,
Lars Marowsky-Br?e <[email protected]>

--
SuSE Labs - Research & Development, SuSE Linux AG

"If anything can go wrong, it will." "Chance favors the prepared (mind)."
-- Capt. Edward A. Murphy -- Louis Pasteur


Attachments:
(No filename) (799.00 B)
(No filename) (189.00 B)
Download all attachments

2003-07-16 08:45:42

by Dimitry V. Ketov

[permalink] [raw]
Subject: RE: Partitioned loop device..

> There is no difference. What makes /dev/loop1a worse than
> /dev/hda1? It's just block devices, that's it.
Yes, it is. But I meant its still impossible to use legacy fdisk to
create that DM mapped partitions (or am I wrong?)

> I have hopes that the entire partitioning code etc will be
> ripped out in 2.7 in favour of full userspace discovery + DM,
> and that MD will hit the same fate...
MD - did you mean metadisks (software raids?)

Dimitry.

2003-07-16 13:44:52

by Kevin Corry

[permalink] [raw]
Subject: Re: Partitioned loop device..

On Wednesday 16 July 2003 03:59, Dimitry V. Ketov wrote:
> > There is no difference. What makes /dev/loop1a worse than
> > /dev/hda1? It's just block devices, that's it.
>
> Yes, it is. But I meant its still impossible to use legacy fdisk to
> create that DM mapped partitions (or am I wrong?)

The program fdisk does not know about Device-Mapper. It only reads and writes
DOS partition tables, and leaves it up to the kernel block-layer to provide
the corresponding block devices. Other tools are available that use the same
partitioning format and work with Device-Mapper.

> > I have hopes that the entire partitioning code etc will be
> > ripped out in 2.7 in favour of full userspace discovery + DM,
> > and that MD will hit the same fate...
>
> MD - did you mean metadisks (software raids?)

Yes. Software RAID devices are currently handled by the MD driver, but much of
that functionality could be ported to Device-Mapper. RAID-linear and RAID-0
can already be supported in DM, and the latest DM release from Sistina has a
module to support RAID-1. So all that's left is to port the RAID-5 code to a
DM module, and modify the user-space tools.

--
Kevin Corry
[email protected]
http://evms.sourceforge.net/

2003-07-17 02:25:31

by kernel

[permalink] [raw]
Subject: Re: Partitioned loop device..

Josh

coming in late on this thread, hope I'm not showing my better half.

You may want to look at the work NASA has done on their enhanced
loopback driver;

ftp://ftp.hq.nasa.gov/pub/ig/ccd/enhanced_loopback/

Allows you to take a physical image of a device (such as one created by
'dd') and mount the logical volumes contained within, even if starting
FS code is beyond the 2GB puke limit. It will mount the volumes 'ro'
for you.

However, be careful if you need true 'ro' on the reiserfs and ext3
filesystems. So far in our testing mounting these 'ro' via loop device
files (/dev/loop0, etc.) *fails*. The journal count *is* incremented on
the 'ro' filesystem and writes *can* still occur.

cheers!

farmerdude


On Tue, 2003-07-15 at 11:53, Josh Litherland wrote:
> In article <[email protected]> you wrote:
>
> > so there's not much of a reason to add partitioning support to the loop
> > driver itself.
>
> Working with sector images of hard drives? I use Linux for data
> recovery jobs and it would be very helpful to me to be able to look at
> DOS partitions inside a loopback device. As it is I must chunk it up
> into seperate files by hand.

2003-07-18 14:11:35

by Christophe Saout

[permalink] [raw]
Subject: RE: Partitioned loop device..

Am Di, 2003-07-15 um 20.32 schrieb Dimitry V. Ketov:

> > You can already use Device-Mapper to create "partitions" on
> > your loop devices,
> You're right but I want _partitions_ but not "partitions" ;)
> It should appears like a real hardware disk, not virtual one.

I just hacked up an ugly small shell script, that uses sfdisk and
dmsetup to create the partition devices over any block device.

Just dmsetup-partitions /dev/loop0 or something.

It will then create devices /dev/mapper/loop0p1, etc... just like hda1
and so on. To remove them use "dmsetup remove loop0p1", etc...

--
Christophe Saout <[email protected]>
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html


Attachments:
dmsetup-partitions (1.74 kB)

2003-07-18 18:55:42

by Mr. James W. Laferriere

[permalink] [raw]
Subject: RE: Partitioned loop device..

Hello Christophe , Are the tools you use in this script only for
2.5/2.6 ? Tia , JimL
On Fri, 18 Jul 2003, Christophe Saout wrote:
> Am Di, 2003-07-15 um 20.32 schrieb Dimitry V. Ketov:
> > > You can already use Device-Mapper to create "partitions" on
> > > your loop devices,
> > You're right but I want _partitions_ but not "partitions" ;)
> > It should appears like a real hardware disk, not virtual one.
> I just hacked up an ugly small shell script, that uses sfdisk and
> dmsetup to create the partition devices over any block device.
> Just dmsetup-partitions /dev/loop0 or something.
> It will then create devices /dev/mapper/loop0p1, etc... just like hda1
> and so on. To remove them use "dmsetup remove loop0p1", etc...
--
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| [email protected] | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+

2003-07-18 23:43:00

by Christophe Saout

[permalink] [raw]
Subject: RE: Partitioned loop device..

Am Fr, 2003-07-18 um 21.10 schrieb Mr. James W. Laferriere:

> Hello Christophe , Are the tools you use in this script only for
> 2.5/2.6 ? Tia , JimL

It uses dmsetup, so it needs the device-mapper. The device-mapper is
integrated into the 2.5/2.6 kernel, but also exists as a patch to the
2.4 kernel (you would probably need to patch the kernel anyway).

You probably want this kernel patch (against 2.4.21):
ftp://ftp.sistina.com/pub/LVM2/device-mapper/patches-version4/combined-linux-2.4.21-devmapper-ioctl.patch

And then compile the dmsetup tool:
ftp://ftp.sistina.com/pub/LVM2/device-mapper/device-mapper.1.00.02.tgz

--
Christophe Saout <[email protected]>
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html