All of lore.kernel.org
 help / color / mirror / Atom feed
From: Loic Dachary <loic@dachary.org>
To: Sage Weil <sage@newdream.net>
Cc: Ceph Development <ceph-devel@vger.kernel.org>
Subject: Re: /sys/block and /dev and partitions
Date: Sat, 15 Aug 2015 17:35:39 +0200	[thread overview]
Message-ID: <55CF5C4B.2010406@dachary.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1508150727060.32106@cobra.newdream.net>

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

Hi Sage,

On 15/08/2015 16:28, Sage Weil wrote:
> On Sat, 15 Aug 2015, Loic Dachary wrote:
>> Hi,
>>
>> Is there a portable and consistent way to figure out if a given /dev/XXX 
>> path (for instance /dev/dm-1) is a partition of a whole device ? 
>> Although checking /sys/block/dm-1/dm/name for a number at the end (like 
>> mpatha1 or mpatha2) would probably work, it feels like a fragile hack. 
>> Looking into /sys/block/dm-1/slaves will lead to 
>> /sys/block/dm-1/slaves/dm-0 and we can check that 
>> /sys/block/dm-*/subsystem is class/block. But that does not necessarily 
>> mean dm-1 is a partition of dm-0, just that it's a slave of dm-0.
> 
> Take a look at is_partition in ceph-disk, whih is the best I came up with.  
> Basically it checks if the device name appears as /sys/block/*/$foo...

That is consistently updated for /dev/sdb or /dev/vdb but things are different when using multipath. I'll rely on /sys/block/dm-?/dm/name instead until a better solution is found. 

Thanks !

> 
> sage
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
Loïc Dachary, Artisan Logiciel Libre


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2015-08-15 15:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-15 11:16 /sys/block and /dev and partitions Loic Dachary
2015-08-15 14:28 ` Sage Weil
2015-08-15 15:35   ` Loic Dachary [this message]
2015-08-15 17:42     ` Ilya Dryomov
2015-08-15 20:56       ` Loic Dachary
2015-08-15 22:00         ` Ilya Dryomov
2015-08-15 22:10           ` Loic Dachary
2015-08-17 21:46             ` Loic Dachary
2015-08-18  9:53               ` Ilya Dryomov
2015-08-18 10:13                 ` Loic Dachary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55CF5C4B.2010406@dachary.org \
    --to=loic@dachary.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@newdream.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.