linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: Partitioned loop device..
@ 2003-07-16  8:59 Dimitry V. Ketov
  2003-07-16 13:51 ` Kevin Corry
  0 siblings, 1 reply; 14+ messages in thread
From: Dimitry V. Ketov @ 2003-07-16  8:59 UTC (permalink / raw)
  To: Lars Marowsky-Bree, Kevin Corry, linux-kernel

> 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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Partitioned loop device..
  2003-07-16  8:59 Partitioned loop device Dimitry V. Ketov
@ 2003-07-16 13:51 ` Kevin Corry
  0 siblings, 0 replies; 14+ messages in thread
From: Kevin Corry @ 2003-07-16 13:51 UTC (permalink / raw)
  To: Dimitry V. Ketov, Lars Marowsky-Bree, linux-kernel

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
kevcorry@us.ibm.com
http://evms.sourceforge.net/


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Partitioned loop device..
  2003-07-18 19:10   ` Mr. James W. Laferriere
@ 2003-07-18 23:57     ` Christophe Saout
  0 siblings, 0 replies; 14+ messages in thread
From: Christophe Saout @ 2003-07-18 23:57 UTC (permalink / raw)
  To: Mr. James W. Laferriere; +Cc: Dimitry V. Ketov, Linux Kernel Maillist

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 <christophe@saout.de>
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Partitioned loop device..
  2003-07-18 14:20 ` Christophe Saout
@ 2003-07-18 19:10   ` Mr. James W. Laferriere
  2003-07-18 23:57     ` Christophe Saout
  0 siblings, 1 reply; 14+ messages in thread
From: Mr. James W. Laferriere @ 2003-07-18 19:10 UTC (permalink / raw)
  To: Christophe Saout; +Cc: Dimitry V. Ketov, Linux Kernel Maillist

	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  |
       | babydr@baby-dragons.com | Coudersport PA 16915 |   only  on  AXP |
       +------------------------------------------------------------------+

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Partitioned loop device..
  2003-07-15 18:32 Dimitry V. Ketov
  2003-07-15 21:15 ` Lars Marowsky-Bree
@ 2003-07-18 14:20 ` Christophe Saout
  2003-07-18 19:10   ` Mr. James W. Laferriere
  1 sibling, 1 reply; 14+ messages in thread
From: Christophe Saout @ 2003-07-18 14:20 UTC (permalink / raw)
  To: Dimitry V. Ketov; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

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 <christophe@saout.de>
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html

[-- Attachment #2: dmsetup-partitions --]
[-- Type: text/x-sh, Size: 1784 bytes --]

#!/bin/sh
SFDISK="`which sfdisk`"
DMSETUP="`which dmsetup`"
if test -z "$1"; then
	echo "Syntax: $0 <block device>"
	exit 1
fi
DEVDIR="`dirname \"\$1\"`"
DEVFILE="`basename \"\$1\"`"
if ! echo "$DEVDIR" | grep '^/' &> /dev/null; then
	DEVDIR="`pwd`/$DEVDIR/"
else
	DEVDIR="$DEVDIR/"
fi
while echo "$DEVDIR" | grep '/\./' &> /dev/null; do
	DEVDIR="`echo \"\$DEVDIR\" | sed -e 's/\/\.\//\//g'`"
done
while echo "$DEVDIR" | grep '/[^/][^/]*/\.\./' &> /dev/null; do
	DEVDIR="`echo \"\$DEVDIR\" | sed -e 's/\/[^/][^/]*\/\.\.\//\//g'`"
done
DEVICE="$DEVDIR$DEVFILE"
if ! test -b "$DEVICE" -a -r "$DEVICE"; then
	echo "Error: Block device $1 can't be accessed"
	exit 1
fi
if ! test -n "$SFDISK" -a -x "$SFDISK"; then
	echo "Error: sfdisk utility not found"
	exit 1
fi
if ! test -n "$DMSETUP" -a -x "$DMSETUP"; then
	echo "Error: dmsetup utility not found"
	exit 1
fi

if test -L "$DEVICE"; then
	DEVICE_="`readlink \"\$DEVICE\"`"
	DEVDIR_="`dirname \"\$DEVICE_\"`"
	DEVFILE_="`basename \"\$DEVICE_\"`"
	if ! echo "$DEVDIR_" | grep '^/' &> /dev/null; then
		DEVDIR_="$DEVDIR$DEVDIR_/"
	else
		DEVDIR_="$DEVDIR_/"
	fi
	while echo "$DEVDIR_" | grep '/\./' &> /dev/null; do
		DEVDIR_="`echo \"\$DEVDIR_\" | sed -e 's/\/\.\//\//g'`"
	done
	while echo "$DEVDIR_" | grep '/[^/][^/]*/\.\./' &> /dev/null; do
		DEVDIR_="`echo \"\$DEVDIR_\" | sed -e 's/\/[^/][^/]*\/\.\.\//\//g'`"
	done
	DEVICE_="$DEVDIR_$DEVFILE_"
else
	DEVICE_="$DEVICE"
fi

TMP="/tmp/partscript.$$"
"$SFDISK" -d "$DEVICE" | grep "^ *$DEVDIR" | sed -e 's/[=,]/ /g' | awk '{ print $1 " " $4 " " $6 }' | \
while read DEV START SIZE; do
	DEV="`echo \"\$DEV\" | sed -e 's/^\/dev\///' -e 's/\//-/g'`"
	test "$SIZE" -gt 0 || continue
	echo $DEV $START $SIZE
	echo "0 $SIZE linear $DEVICE_ $START" > $TMP
	"$DMSETUP" create $DEV $TMP
done

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Partitioned loop device..
  2003-07-15 15:53   ` Josh Litherland
  2003-07-15 16:04     ` Kevin Corry
  2003-07-15 16:05     ` Herbert Pötzl
@ 2003-07-17  2:44     ` kernel
  2 siblings, 0 replies; 14+ messages in thread
From: kernel @ 2003-07-17  2:44 UTC (permalink / raw)
  To: Josh Litherland; +Cc: Kevin Corry, linux-kernel

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 <200307151001.44218.kevcorry@us.ibm.com> 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.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Partitioned loop device..
  2003-07-15 18:32 Dimitry V. Ketov
@ 2003-07-15 21:15 ` Lars Marowsky-Bree
  2003-07-18 14:20 ` Christophe Saout
  1 sibling, 0 replies; 14+ messages in thread
From: Lars Marowsky-Bree @ 2003-07-15 21:15 UTC (permalink / raw)
  To: Dimitry V. Ketov, Kevin Corry, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

On 2003-07-15T22:32:11,
   "Dimitry V. Ketov" <Dimitry.Ketov@avalon.ru> 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 <lmb@suse.de>

-- 
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

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Partitioned loop device..
@ 2003-07-15 18:32 Dimitry V. Ketov
  2003-07-15 21:15 ` Lars Marowsky-Bree
  2003-07-18 14:20 ` Christophe Saout
  0 siblings, 2 replies; 14+ messages in thread
From: Dimitry V. Ketov @ 2003-07-15 18:32 UTC (permalink / raw)
  To: Kevin Corry, linux-kernel

> 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 ;)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Partitioned loop device..
  2003-07-15 15:53   ` Josh Litherland
  2003-07-15 16:04     ` Kevin Corry
@ 2003-07-15 16:05     ` Herbert Pötzl
  2003-07-17  2:44     ` kernel
  2 siblings, 0 replies; 14+ messages in thread
From: Herbert Pötzl @ 2003-07-15 16:05 UTC (permalink / raw)
  To: Josh Litherland; +Cc: linux-kernel

On Tue, Jul 15, 2003 at 11:53:17AM -0400, Josh Litherland wrote:
> In article <200307151001.44218.kevcorry@us.ibm.com> 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 (josh@emperorlinux.com)
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Partitioned loop device..
  2003-07-15 15:53   ` Josh Litherland
@ 2003-07-15 16:04     ` Kevin Corry
  2003-07-15 16:05     ` Herbert Pötzl
  2003-07-17  2:44     ` kernel
  2 siblings, 0 replies; 14+ messages in thread
From: Kevin Corry @ 2003-07-15 16:04 UTC (permalink / raw)
  To: Josh Litherland; +Cc: linux-kernel

On Tuesday 15 July 2003 10:53, Josh Litherland wrote:
> In article <200307151001.44218.kevcorry@us.ibm.com> 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
kevcorry@us.ibm.com
http://evms.sourceforge.net/


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Partitioned loop device..
  2003-07-15 15:01 ` Kevin Corry
@ 2003-07-15 15:53   ` Josh Litherland
  2003-07-15 16:04     ` Kevin Corry
                       ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Josh Litherland @ 2003-07-15 15:53 UTC (permalink / raw)
  To: Kevin Corry; +Cc: linux-kernel

In article <200307151001.44218.kevcorry@us.ibm.com> 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 (josh@emperorlinux.com)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Partitioned loop device..
  2003-07-15  8:46 Dimitry V. Ketov
@ 2003-07-15 15:01 ` Kevin Corry
  2003-07-15 15:53   ` Josh Litherland
  0 siblings, 1 reply; 14+ messages in thread
From: Kevin Corry @ 2003-07-15 15:01 UTC (permalink / raw)
  To: Dimitry V. Ketov, linux-kernel

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
kevcorry@us.ibm.com
http://evms.sourceforge.net/


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Partitioned loop device..
@ 2003-07-15  8:46 Dimitry V. Ketov
  2003-07-15 15:01 ` Kevin Corry
  0 siblings, 1 reply; 14+ messages in thread
From: Dimitry V. Ketov @ 2003-07-15  8:46 UTC (permalink / raw)
  To: linux-kernel

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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Partitioned loop device..
@ 2003-07-15  7:10 Dimitry V. Ketov
  0 siblings, 0 replies; 14+ messages in thread
From: Dimitry V. Ketov @ 2003-07-15  7:10 UTC (permalink / raw)
  To: linux-kernel

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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2003-07-18 23:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-16  8:59 Partitioned loop device Dimitry V. Ketov
2003-07-16 13:51 ` Kevin Corry
  -- strict thread matches above, loose matches on Subject: below --
2003-07-15 18:32 Dimitry V. Ketov
2003-07-15 21:15 ` Lars Marowsky-Bree
2003-07-18 14:20 ` Christophe Saout
2003-07-18 19:10   ` Mr. James W. Laferriere
2003-07-18 23:57     ` Christophe Saout
2003-07-15  8:46 Dimitry V. Ketov
2003-07-15 15:01 ` Kevin Corry
2003-07-15 15:53   ` Josh Litherland
2003-07-15 16:04     ` Kevin Corry
2003-07-15 16:05     ` Herbert Pötzl
2003-07-17  2:44     ` kernel
2003-07-15  7:10 Dimitry V. Ketov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).