Hi,
that was a good hint, thanks a lot!
The best at that solution is that it works for all filesystems: Just test if the
output of $type (type=`blkid -s TYPE -o value $loopdev`) is empty (''), then it is no
filesystem and the loopaes password was wrong or the device/fs is broken.
Felix
On 25. October 2010 - 08:29, C Anthony Risinger wrote:
> Date: Mon, 25 Oct 2010 08:29:58 -0500
> From: C Anthony Risinger <anthony@xxxxxxxx>
> To: Jérôme Poulin <jeromepoulin@xxxxxxxxx>
> Cc: linux-btrfs <linux-btrfs@xxxxxxxxxxxxxxx>
> Subject: Re: Determine if a given fs is a btrfs fs
>
> On Mon, Oct 25, 2010 at 6:31 AM, Jérôme Poulin <jeromepoulin@xxxxxxxxx> wrote:
> > On Sun, Oct 24, 2010 at 5:32 PM, Jérôme Poulin <jeromepoulin@xxxxxxxxx> 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?
>
> imo, the best way is:
>
> # root must be btrfs else silent return
> [ "$(blkid -s TYPE -o value ${root})" = btrfs ] || return 0
>
> at least that the way i do it in my initramfs hook; seems to be reliable.
>
> C Anthony
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html