Hi, I''ve some btrfs fs which are encrypted with loopaes. I decrypt them in a script during bootup. Now I want to determine if the decrypted fs is a btrfs fs. If not I missspelled the password and I can handle that error in my script. Thanks for any help! Felix -- 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
Here are some cues... p4 jerome # file -s /dev/mapper/vgP4RAID5-openwrt /dev/mapper/vgP4RAID5-openwrt: symbolic link to `../dm-22'' p4 jerome # file -s /dev/dm-22 /dev/dm-22: BTRFS Filesystem (label "p4-openwrt", sectorsize 4096, nodesize 4096, leafsize 4096) p4 jerome # btrfs device scan /dev/dm-22 Scanning for Btrfs filesystems in ''/dev/dm-22'' p4 jerome # echo $? 0 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 p4 jerome # blkid | grep btrfs /dev/mapper/vgP4RAID5-openwrt: LABEL="p4-openwrt" UUID="9a68f4cc-4bda-4cdb-9726-481b340f742c" UUID_SUB="37bfc8b8-c8aa-415e-bbb3-cbb50cca2ab7" TYPE="btrfs" p4 jerome # On Sun, Oct 24, 2010 at 4:24 PM, Felix Blanke <felixblanke@gmail.com> wrote:> Hi, > > I''ve some btrfs fs which are encrypted with loopaes. > > I decrypt them in a script during bootup. Now I want to determine if the decrypted fs > is a btrfs fs. If not I missspelled the password and I can handle that error in my > script. > > > Thanks for any help! > > > Felix > -- > 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 >-- 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
On Sun, Oct 24, 2010 at 5:32 PM, Jérôme Poulin <jeromepoulin@gmail.com> wrote: ...> p4 jerome # btrfs device scan /dev/dm-22 > Scanning for Btrfs filesystems in ''/dev/dm-22'' > p4 jerome # echo $? > 0This 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? -- 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
On Mon, Oct 25, 2010 at 6:31 AM, Jérôme Poulin <jeromepoulin@gmail.com> wrote:> On Sun, Oct 24, 2010 at 5:32 PM, Jérôme Poulin <jeromepoulin@gmail.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?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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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@extof.me> > To: Jérôme Poulin <jeromepoulin@gmail.com> > Cc: linux-btrfs <linux-btrfs@vger.kernel.org> > 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@gmail.com> wrote: > > On Sun, Oct 24, 2010 at 5:32 PM, Jérôme Poulin <jeromepoulin@gmail.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? > > 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@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