linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mount a multi-device filesystem using a loopback device
@ 2011-09-07  4:18 Jeff Liu
  2011-09-07  4:37 ` cwillu
       [not found] ` <4E670FB8.4000705@cn.fujitsu.com>
  0 siblings, 2 replies; 6+ messages in thread
From: Jeff Liu @ 2011-09-07  4:18 UTC (permalink / raw)
  To: linux-btrfs

Hello,

I was trying to create a multi-device Btrfs filesystem using two 
loopback devices, by referring to the following page:
https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices

However, I met a strange thing while mounting the first loop device 
without any extra mount options,

1.  Create and format two images, the 1st in 400Mbytes, and 2nd in 
286Mbytes.
root@pibroch:/btrfs-progs# ls -lh /usr/src/linux-3.0/img*
-rw-r--r-- 1 jeff jeff 400M 2011-09-07 12:00 /usr/src/linux-3.0/img0
-rw-r--r-- 1 jeff jeff 286M 2011-09-07 12:00 /usr/src/linux-3.0/img1

root@pibroch:/btrfs-progs# mkfs.btrfs /usr/src/linux-3.0/img0 
/usr/src/linux-3.0/img1

WARNING! - Btrfs v0.19-35-g1b444cd IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using

failed to read /dev/sr0
failed to read /dev/sr0
adding device /usr/src/linux-3.0/img1 id 2
fs created label (null) on /usr/src/linux-3.0/img0
     nodesize 4096 leafsize 4096 sectorsize 4096 size 685.50MB
Btrfs v0.19-35-g1b444cd

2. Setup the loopback manually:
root@pibroch:/btrfs-progs# losetup /dev/loop0 /usr/src/linux-3.0/img0
root@pibroch:/btrfs-progs# losetup /dev/loop1 /usr/src/linux-3.0/img1
root@pibroch:/btrfs-progs# losetup -a
/dev/loop0: [0802]:1736614 (/usr/src/linux-3.0/img0)
/dev/loop1: [0802]:1736726 (/usr/src/linux-3.0/img1)

3. Try to mount loop0, it will failed as below:
root@pibroch:/btrfs-progs# mount /dev/loop0 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
        missing codepage or helper program, or other error
        In some cases useful info is found in syslog - try
        dmesg | tail  or so

4. Try to mount loop1, it works:
root@pibroch:/btrfs-progs# mount /dev/loop1 /mnt
root@pibroch:/btrfs-progs# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              46G   23G   21G  52% /
none                  896M  700K  895M   1% /dev
none                  957M   80K  957M   1% /dev/shm
none                  957M  104K  957M   1% /var/run
none                  957M     0  957M   0% /var/lock
/dev/loop1            686M   56K  493M   1% /mnt

5. umount loop1, and try to mount loop0 again, it works at this time:
root@pibroch:/btrfs-progs# umount /mnt
root@pibroch:/btrfs-progs# mount /dev/loop0 /mnt
root@pibroch:/btrfs-progs# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              46G   23G   21G  52% /
none                  896M  700K  895M   1% /dev
none                  957M   80K  957M   1% /dev/shm
none                  957M  104K  957M   1% /var/run
none                  957M     0  957M   0% /var/lock
/dev/loop0            686M   56K  493M   1% /mnt

According to my debugging result, for the 1st time, mount loop0 failed 
at around volumes.c:3468:

                 map->stripes[i].dev = btrfs_find_device(root, devid, uuid,
                                                         NULL);
                 if (!map->stripes[i].dev && !btrfs_test_opt(root, 
DEGRADED)) {
                         kfree(map);
                         free_extent_map(em);
                         return -EIO;

So I repeat the above steps again, and try to mount loop0 with "-o 
degraded" option, it works as expected:
root@pibroch:/btrfs-progs# mount -o degraded /dev/loop0 /mnt
root@pibroch:/btrfs-progs# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              46G   23G   21G  52% /
none                  896M  700K  895M   1% /dev
none                  957M  140K  957M   1% /dev/shm
none                  957M  104K  957M   1% /var/run
none                  957M     0  957M   0% /var/lock
/dev/loop0            686M   56K  136M   1% /mnt


kernel version 3.1.0-rc2+.

Is it a bug? or Am I missing something?


Thanks,
-Jeff

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

* Re: mount a multi-device filesystem using a loopback device
  2011-09-07  4:18 mount a multi-device filesystem using a loopback device Jeff Liu
@ 2011-09-07  4:37 ` cwillu
  2011-09-07  6:44   ` Jeff Liu
       [not found] ` <4E670FB8.4000705@cn.fujitsu.com>
  1 sibling, 1 reply; 6+ messages in thread
From: cwillu @ 2011-09-07  4:37 UTC (permalink / raw)
  To: jeff.liu; +Cc: linux-btrfs

> 1.  Create and format two images, the 1st in 400Mbytes, and 2nd in 286Mbytes.
> root@pibroch:/btrfs-progs# ls -lh /usr/src/linux-3.0/img*
> -rw-r--r-- 1 jeff jeff 400M 2011-09-07 12:00 /usr/src/linux-3.0/img0
> -rw-r--r-- 1 jeff jeff 286M 2011-09-07 12:00 /usr/src/linux-3.0/img1

Very small btrfs filesystem require special handling, mixed block
groups in particular, which I believe also requires an updated mkfs
from the integration repo.

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

* Re: mount a multi-device filesystem using a loopback device
       [not found] ` <4E670FB8.4000705@cn.fujitsu.com>
@ 2011-09-07  6:42   ` Jeff Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Liu @ 2011-09-07  6:42 UTC (permalink / raw)
  To: Li Zefan; +Cc: linux-btrfs


On 09/07/2011 02:31 PM, Li Zefan wrote:
>> Is it a bug? or Am I missing something?
>>
> You need to run this before mounting the devices:
>
>    # btrfs device scan
Thank you, it works by executing device scan.

-Jeff

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

* Re: mount a multi-device filesystem using a loopback device
  2011-09-07  4:37 ` cwillu
@ 2011-09-07  6:44   ` Jeff Liu
  2011-09-08  5:32     ` C Anthony Risinger
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Liu @ 2011-09-07  6:44 UTC (permalink / raw)
  To: cwillu; +Cc: linux-btrfs

On 09/07/2011 12:37 PM, cwillu wrote:
>> 1.  Create and format two images, the 1st in 400Mbytes, and 2nd in 286Mbytes.
>> root@pibroch:/btrfs-progs# ls -lh /usr/src/linux-3.0/img*
>> -rw-r--r-- 1 jeff jeff 400M 2011-09-07 12:00 /usr/src/linux-3.0/img0
>> -rw-r--r-- 1 jeff jeff 286M 2011-09-07 12:00 /usr/src/linux-3.0/img1
> Very small btrfs filesystem require special handling, mixed block
> groups in particular, which I believe also requires an updated mkfs
> from the integration repo.
Thanks for your response, however, even if I enlarged the image size to 
2G, still got no luck.
Per Zefan's comments, run 'btrfs device scan' fixed this issue.

-Jeff
> --
> 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


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

* Re: mount a multi-device filesystem using a loopback device
  2011-09-07  6:44   ` Jeff Liu
@ 2011-09-08  5:32     ` C Anthony Risinger
  2011-09-08  6:31       ` Jeff Liu
  0 siblings, 1 reply; 6+ messages in thread
From: C Anthony Risinger @ 2011-09-08  5:32 UTC (permalink / raw)
  To: jeff.liu; +Cc: cwillu, linux-btrfs

On Wed, Sep 7, 2011 at 1:44 AM, Jeff Liu <jeff.liu@oracle.com> wrote:
> On 09/07/2011 12:37 PM, cwillu wrote:
>>>
>>> 1. =C2=A0Create and format two images, the 1st in 400Mbytes, and 2n=
d in
>>> 286Mbytes.
>>> root@pibroch:/btrfs-progs# ls -lh /usr/src/linux-3.0/img*
>>> -rw-r--r-- 1 jeff jeff 400M 2011-09-07 12:00 /usr/src/linux-3.0/img=
0
>>> -rw-r--r-- 1 jeff jeff 286M 2011-09-07 12:00 /usr/src/linux-3.0/img=
1
>>
>> Very small btrfs filesystem require special handling, mixed block
>> groups in particular, which I believe also requires an updated mkfs
>> from the integration repo.
>
> Thanks for your response, however, even if I enlarged the image size =
to 2G,
> still got no luck.
> Per Zefan's comments, run 'btrfs device scan' fixed this issue.

you should be able to achieve this via `device=3D` mount option(s?) as =
well:

https://btrfs.wiki.kernel.org/index.php/Getting_started#Mount_Options

=2E.. for completeness :-) ... and posterity or whatever.

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

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

* Re: mount a multi-device filesystem using a loopback device
  2011-09-08  5:32     ` C Anthony Risinger
@ 2011-09-08  6:31       ` Jeff Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Liu @ 2011-09-08  6:31 UTC (permalink / raw)
  To: C Anthony Risinger; +Cc: cwillu, linux-btrfs

On 09/08/2011 01:32 PM, C Anthony Risinger wrote:
> On Wed, Sep 7, 2011 at 1:44 AM, Jeff Liu<jeff.liu@oracle.com>  wrote:
>> On 09/07/2011 12:37 PM, cwillu wrote:
>>>> 1.  Create and format two images, the 1st in 400Mbytes, and 2nd in
>>>> 286Mbytes.
>>>> root@pibroch:/btrfs-progs# ls -lh /usr/src/linux-3.0/img*
>>>> -rw-r--r-- 1 jeff jeff 400M 2011-09-07 12:00 /usr/src/linux-3.0/img0
>>>> -rw-r--r-- 1 jeff jeff 286M 2011-09-07 12:00 /usr/src/linux-3.0/img1
>>> Very small btrfs filesystem require special handling, mixed block
>>> groups in particular, which I believe also requires an updated mkfs
>>> from the integration repo.
>> Thanks for your response, however, even if I enlarged the image size to 2G,
>> still got no luck.
>> Per Zefan's comments, run 'btrfs device scan' fixed this issue.
> you should be able to achieve this via `device=` mount option(s?) as well:
>
> https://btrfs.wiki.kernel.org/index.php/Getting_started#Mount_Options
>
> ... for completeness :-) ... and posterity or whatever.
Nice, thanks for your sharing. 8-)

-Jeff
> 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


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

end of thread, other threads:[~2011-09-08  6:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-07  4:18 mount a multi-device filesystem using a loopback device Jeff Liu
2011-09-07  4:37 ` cwillu
2011-09-07  6:44   ` Jeff Liu
2011-09-08  5:32     ` C Anthony Risinger
2011-09-08  6:31       ` Jeff Liu
     [not found] ` <4E670FB8.4000705@cn.fujitsu.com>
2011-09-07  6:42   ` Jeff Liu

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).