linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Blanke <felixblanke@gmail.com>
To: C Anthony Risinger <anthony@extof.me>
Cc: "Jérôme Poulin" <jeromepoulin@gmail.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: Determine if a given fs is a btrfs fs
Date: Mon, 25 Oct 2010 21:27:30 +0200	[thread overview]
Message-ID: <20101025192730.GA2839@scooter> (raw)
In-Reply-To: <AANLkTimdQPmn_VPzs6H_HT_+m9uM2PCno1W_D0mib8Yx@mail.gmail.com>

Hi,

that was a good hint, thanks a lot!

The best at that solution is that it works for all filesystems: Just te=
st if the
output of $type (type=3D`blkid -s TYPE -o value $loopdev`) is empty (''=
), then it is no
filesystem and the loopaes password was wrong or the device/fs is broke=
n.



=46elix


On 25. October 2010 - 08:29, C Anthony Risinger wrote:
> Date:	Mon, 25 Oct 2010 08:29:58 -0500
> From: C Anthony Risinger <anthony@extof.me>
> To: J=E9r=F4me Poulin <jeromepoulin@gmail.com>
> Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
> Subject: Re: Determine if a given fs is a btrfs fs
>=20
> On Mon, Oct 25, 2010 at 6:31 AM, J=E9r=F4me Poulin <jeromepoulin@gmai=
l.com> wrote:
> > On Sun, Oct 24, 2010 at 5:32 PM, J=E9r=F4me Poulin <jeromepoulin@gm=
ail.com> wrote:
> > ...
> >> p4 jerome # btrfs device scan /dev/dm-22
> >> Scanning for Btrfs filesystems in '/dev/dm-22'
> >> p4 jerome # echo $?
> >> 0
> > This is OK.
> >
> >> p4 jerome # btrfs device scan /dev/sda
> >> Scanning for Btrfs filesystems in '/dev/sda'
> >> ERROR: unable to scan the device '/dev/sda'
> >> p4 jerome # echo $?
> >> 11
> > ...
> > But isn't that error misleading, btrfs scan was succesfully able to
> > scan /dev/sda, but, it doesn't contain btrfs, right?
>=20
> imo, the best way is:
>=20
> # root must be btrfs else silent return
> [ "$(blkid -s TYPE -o value ${root})" =3D btrfs ] || return 0
>=20
> at least that the way i do it in my initramfs hook; seems to be relia=
ble.
>=20
> C Anthony
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs=
" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
---end quoted text---
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2010-10-25 19:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-24 20:24 Determine if a given fs is a btrfs fs Felix Blanke
2010-10-24 21:32 ` Jérôme Poulin
2010-10-25 11:31   ` Jérôme Poulin
2010-10-25 13:29     ` C Anthony Risinger
2010-10-25 19:27       ` Felix Blanke [this message]

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=20101025192730.GA2839@scooter \
    --to=felixblanke@gmail.com \
    --cc=anthony@extof.me \
    --cc=jeromepoulin@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 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).