All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] losetup: support for physical devices
@ 2015-01-14 17:59 Lucio Crusca
  2015-01-14 20:08 ` Karel Zak
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lucio Crusca @ 2015-01-14 17:59 UTC (permalink / raw)
  To: util-linux

During a disaster recovery I found that losetup either 

1. does not support creating loop devices that target physical devices. In 
this case I think there exists a compelling reason to support them 
(http://serverfault.com/questions/659484) and this bug report is a wishlist 
bug 

or 

2. it does support physical devices, but it is an undocumented feature (at 
least in the manpage) and the warning it issues is misleading beacuse it 
makes you think it doesn't support them ("losetup: /dev/sdc2: warning: file 
smaller than 512 bytes, the loop device maybe be useless or invisible for 
system tools"). In this case this could be a documentation bug.

I haven't tested which of the two possibilities is the real situation, but 
I'm pretty sure you already know.

Thanks for your attention,
Lucio.


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

* Re: [BUG] losetup: support for physical devices
  2015-01-14 17:59 [BUG] losetup: support for physical devices Lucio Crusca
@ 2015-01-14 20:08 ` Karel Zak
  2015-01-14 20:13 ` Karel Zak
  2015-01-26  3:21 ` Dale R. Worley
  2 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2015-01-14 20:08 UTC (permalink / raw)
  To: Lucio Crusca; +Cc: util-linux

On Wed, Jan 14, 2015 at 06:59:58PM +0100, Lucio Crusca wrote:
> During a disaster recovery I found that losetup either 
> 
> 1. does not support creating loop devices that target physical devices. In 
> this case I think there exists a compelling reason to support them 
> (http://serverfault.com/questions/659484) and this bug report is a wishlist 
> bug 
> 
> or 
> 
> 2. it does support physical devices, but it is an undocumented feature (at 
> least in the manpage) and the warning it issues is misleading beacuse it 
> makes you think it doesn't support them ("losetup: /dev/sdc2: warning: file 
> smaller than 512 bytes, the loop device maybe be useless or invisible for 
> system tools"). In this case this could be a documentation bug.

commit b048b8af3a5568c90f6e0c2d56f6cb399dedb0d1
Author: Karel Zak <kzak@redhat.com>
Date:   Mon May 13 11:00:47 2013 +0200

    losetup: use warn_size() for regular files only
        
Signed-off-by: Karel Zak <kzak@redhat.com>


    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

* Re: [BUG] losetup: support for physical devices
  2015-01-14 17:59 [BUG] losetup: support for physical devices Lucio Crusca
  2015-01-14 20:08 ` Karel Zak
@ 2015-01-14 20:13 ` Karel Zak
  2015-01-26  3:21 ` Dale R. Worley
  2 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2015-01-14 20:13 UTC (permalink / raw)
  To: Lucio Crusca; +Cc: util-linux

On Wed, Jan 14, 2015 at 06:59:58PM +0100, Lucio Crusca wrote:
> http://serverfault.com/questions/659484

 BTW, it should be possible to use delpart(8) to release sdc1
 partition and use addpart(8) to define the partition from 
 another offset. Then you avoid /deb/loopN at all.

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

* Re: [BUG] losetup: support for physical devices
  2015-01-14 17:59 [BUG] losetup: support for physical devices Lucio Crusca
  2015-01-14 20:08 ` Karel Zak
  2015-01-14 20:13 ` Karel Zak
@ 2015-01-26  3:21 ` Dale R. Worley
  2015-01-26  5:06   ` Peter Cordes
  2 siblings, 1 reply; 5+ messages in thread
From: Dale R. Worley @ 2015-01-26  3:21 UTC (permalink / raw)
  To: Lucio Crusca; +Cc: util-linux

Lucio Crusca <lucio@sulweb.org> writes:
> During a disaster recovery I found that losetup either 
>
> 1. does not support creating loop devices that target physical devices. In 
> this case I think there exists a compelling reason to support them 
> (http://serverfault.com/questions/659484) and this bug report is a wishlist 
> bug 
>
> or 
>
> 2. it does support physical devices, but it is an undocumented feature (at 
> least in the manpage) and the warning it issues is misleading beacuse it 
> makes you think it doesn't support them ("losetup: /dev/sdc2: warning: file 
> smaller than 512 bytes, the loop device maybe be useless or invisible for 
> system tools"). In this case this could be a documentation bug.
>
> I haven't tested which of the two possibilities is the real situation, but 
> I'm pretty sure you already know.

I don't recall what I've done that convinced me, but I'm *sure* that you
can do

    losetup -o [offset] {-f[--show]|loopdev} /dev/sdXXX

This is implicit throughout Linux, because any block device is also a
"file", and can be read/written as such.  (You just can't change its
size.)

What command are you executing?  What error are you seeing?

Dale

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

* Re: [BUG] losetup: support for physical devices
  2015-01-26  3:21 ` Dale R. Worley
@ 2015-01-26  5:06   ` Peter Cordes
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Cordes @ 2015-01-26  5:06 UTC (permalink / raw)
  To: Dale R. Worley; +Cc: Lucio Crusca, util-linux

On Sun, Jan 25, 2015 at 10:21:09PM -0500, Dale R. Worley wrote:
> Lucio Crusca <lucio@sulweb.org> writes:
> > During a disaster recovery I found that losetup either 
> >
> > 1. does not support creating loop devices that target physical devices. In 
> > this case I think there exists a compelling reason to support them 
> > (http://serverfault.com/questions/659484) and this bug report is a wishlist 
> > bug 
> >
> > or 
> >
> > 2. it does support physical devices, but it is an undocumented feature (at 
> > least in the manpage) and the warning it issues is misleading beacuse it 
> > makes you think it doesn't support them ("losetup: /dev/sdc2: warning: file 
> > smaller than 512 bytes, the loop device maybe be useless or invisible for 
> > system tools"). In this case this could be a documentation bug.
> >
> > I haven't tested which of the two possibilities is the real situation, but 
> > I'm pretty sure you already know.
> 
> I don't recall what I've done that convinced me, but I'm *sure* that you
> can do
> 
>     losetup -o [offset] {-f[--show]|loopdev} /dev/sdXXX

 Yup, it works for me.  I posted an answer on
http://serverfault.com/questions/659484, gist of it is that 

sudo losetup -o 32256 -f /dev/sdb3
 sets up a loopback dev.  Test with:
sudo tail -c 32257 /dev/sdb3 | sudo cmp - /dev/loop5 

 If you leave out -f or a specific arg like /dev/loop0, then the
command fails because  losetup /dev/sdb3  means you're asking losetup
to print info on a loopback device called /dev/sdb3.

loop: can't get info on device /dev/sdb3: Inappropriate ioctl for device


 IDK how you got it to print
 
losetup: /dev/sdc2: warning: file smaller than 512 bytes, the loop
device maybe be useless or invisible for system tools



-- 
#define X(x,y) x##y
Peter Cordes ;  e-mail: X(peter@cor , des.ca)

"The gods confound the man who first found out how to distinguish the hours!
 Confound him, too, who in this place set up a sundial, to cut and hack
 my day so wretchedly into small pieces!" -- Plautus, 200 BC

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

end of thread, other threads:[~2015-01-26  5:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-14 17:59 [BUG] losetup: support for physical devices Lucio Crusca
2015-01-14 20:08 ` Karel Zak
2015-01-14 20:13 ` Karel Zak
2015-01-26  3:21 ` Dale R. Worley
2015-01-26  5:06   ` Peter Cordes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.