创建并挂载由多个磁盘映像组成的文件系统

创建并挂载由多个磁盘映像组成的文件系统

我正在 AWS 上从四个 EBS 快照创建四个卷。这四个卷组成一个 BTRFS 多设备驱动器。这些驱动器没有分区表,也就是说,我已经运行过mkfs.btrfs /dev/xvdf /dev/xvdg等等。

当我创建卷时,我使用 AWS CLI 工具将它们附加到一起,然后运行btrfs device scan /dev/xvd{f,g,h,i}。设备有一个标签,因此要安装它们,我运行(我尝试了几种方法)mount -t btrfs -o ro,nospace_cache,clear_cache -L LABEL /tmp/dir。这会挂起很长时间,15-20 分钟。每个设备都是 2TB。

当我查看 dmesg 时,我看到了以下消息。当 dmesg 挂起时,dmesg 中没有显示其他输出。我不知道该检查什么才能找出导致此挂起的原因。

[ 3316.093665] blkfront: xvdf: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
[ 3316.124269]  xvdf: unknown partition table
[ 3316.430563] btrfs: device label BtrFcdData devid 1 transid 592370 /dev/xvdf
[ 3316.432660] btrfs: device label BtrFcdData devid 1 transid 592370 /dev/xvdf
[ 3317.067647] blkfront: xvdg: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
[ 3317.111985]  xvdg: unknown partition table
[ 3317.450861] btrfs: device label BtrFcdData devid 2 transid 592370 /dev/xvdg
[ 3317.453036] btrfs: device label BtrFcdData devid 2 transid 592370 /dev/xvdg
[ 3318.186270] blkfront: xvdh: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
[ 3318.232822]  xvdh: unknown partition table
[ 3319.025208] btrfs: device label BtrFcdData devid 3 transid 592370 /dev/xvdh
[ 3319.027380] btrfs: device label BtrFcdData devid 3 transid 592370 /dev/xvdh
[ 3320.067903] blkfront: xvdi: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
[ 3320.123265]  xvdi: unknown partition table
[ 3320.495547] btrfs: device label BtrFcdData devid 4 transid 592370 /dev/xvdi
[ 3320.497922] btrfs: device label BtrFcdData devid 4 transid 592370 /dev/xvdi
[ 3321.436803] btrfs: device label BtrFcdData devid 1 transid 592370 /dev/xvdf
[ 3321.437252] btrfs: device label BtrFcdData devid 2 transid 592370 /dev/xvdg
[ 3321.437641] btrfs: device label BtrFcdData devid 3 transid 592370 /dev/xvdh
[ 3321.438040] btrfs: device label BtrFcdData devid 4 transid 592370 /dev/xvdi
[ 3457.266257] blkfront: xvdf: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
[ 3457.315871]  xvdf: unknown partition table
[ 3457.862287] btrfs: device label BtrFcdData devid 1 transid 592370 /dev/xvdf
[ 3457.864513] btrfs: device label BtrFcdData devid 1 transid 592370 /dev/xvdf
[ 3458.413241] blkfront: xvdg: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
[ 3458.519586]  xvdg: unknown partition table
[ 3458.941200] btrfs: device label BtrFcdData devid 2 transid 592370 /dev/xvdg
[ 3458.943531] btrfs: device label BtrFcdData devid 2 transid 592370 /dev/xvdg
[ 3460.121281] blkfront: xvdh: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
[ 3460.198695]  xvdh: unknown partition table
[ 3460.805858] btrfs: device label BtrFcdData devid 3 transid 592370 /dev/xvdh
[ 3460.808173] btrfs: device label BtrFcdData devid 3 transid 592370 /dev/xvdh
[ 3461.146042] blkfront: xvdi: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
[ 3461.271872]  xvdi: unknown partition table
[ 3462.355409] btrfs: device label BtrFcdData devid 4 transid 592370 /dev/xvdi
[ 3462.357822] btrfs: device label BtrFcdData devid 4 transid 592370 /dev/xvdi
[ 3463.185250] btrfs: device label BtrFcdData devid 1 transid 592370 /dev/xvdf
[ 3463.185669] btrfs: device label BtrFcdData devid 2 transid 592370 /dev/xvdg
[ 3463.186098] btrfs: device label BtrFcdData devid 3 transid 592370 /dev/xvdh
[ 3463.186471] btrfs: device label BtrFcdData devid 4 transid 592370 /dev/xvdi
[ 3463.217317] btrfs: device label BtrFcdData devid 4 transid 592370 /dev/xvdi
[ 3463.219230] btrfs: disabling disk space caching
[ 3463.219233] btrfs: force clearing of disk cache
[ 4930.891445] btrfs: device fsid e512929a-72e4-4bf9-bf1d-c4744bb9cb06 devid 2 transid 27031 /dev/xvdb
[ 4930.893685] btrfs: device fsid e512929a-72e4-4bf9-bf1d-c4744bb9cb06 devid 2 transid 27031 /dev/xvdb
[ 4930.949380] btrfs: device fsid e512929a-72e4-4bf9-bf1d-c4744bb9cb06 devid 1 transid 27031 /dev/xvdc
[ 4930.951209] btrfs: device fsid e512929a-72e4-4bf9-bf1d-c4744bb9cb06 devid 1 transid 27031 /dev/xvdc
[ 4937.133509] btrfs: device fsid e512929a-72e4-4bf9-bf1d-c4744bb9cb06 devid 2 transid 27031 /dev/xvdb
[ 4937.135297] btrfs: device fsid e512929a-72e4-4bf9-bf1d-c4744bb9cb06 devid 2 transid 27031 /dev/xvdb
[ 4937.135757] btrfs: device fsid e512929a-72e4-4bf9-bf1d-c4744bb9cb06 devid 1 transid 27031 /dev/xvdc
[ 4937.137575] btrfs: device fsid e512929a-72e4-4bf9-bf1d-c4744bb9cb06 devid 1 transid 27031 /dev/xvdc

编辑:

运行watch iostat -dk 2 -x 1显示一些不同的数字,首先显示前两个设备的利用率很高,然后显示以下内容:

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
xvda              0.01     1.49    0.87    2.99    22.34   274.17   153.71     1.62  419.08    5.06  540.15   3.91   1.51
xvdd              0.00     0.00    0.02    0.00     0.07     0.00     7.91     0.00    0.41    0.41    0.00   0.41   0.00
xvdb              0.00     0.10    1.53    1.59    23.88    31.80    35.69     0.16   52.79    5.00   98.68   2.80   0.87
xvdc              0.00     0.08    1.58    1.37    24.99    27.43    35.49     0.25   84.70    5.21  176.74   3.45   1.02
xvdf              0.00     2.11    0.48   13.36     7.44  1325.75   192.64     2.25  162.64    5.33  168.27   2.18   3.01
xvdt              0.00     0.00    0.01    0.00     0.08     0.00    31.25     0.00   77.77   77.77    0.00  72.35   0.04
xvdy              0.00     0.00    0.00    0.00     0.03     0.00    30.32     0.00  102.43  102.43    0.00 101.05   0.02
xvdu              0.00     0.00    0.00    0.00     0.00     0.00    20.96     0.00   75.64   75.64    0.00  75.64   0.00
xvdo              0.00     0.00    0.00    0.00     0.01     0.00    16.84     0.00   38.53   38.53    0.00  38.53   0.00

这是系统日志的一个片段:

Nov 23 17:35:01 ip-10-0-1-123 CRON[11806]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Nov 23 17:38:28 ip-10-0-1-123 kernel: [605946.625013] blkfront: xvdt: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
Nov 23 17:38:28 ip-10-0-1-123 kernel: [605946.732903]  xvdt: unknown partition table
Nov 23 17:38:28 ip-10-0-1-123 kernel: [605947.017249] btrfs: device label BtrFcdData devid 1 transid 616951 /dev/xvdt
Nov 23 17:38:29 ip-10-0-1-123 kernel: [605947.036501] btrfs: device label BtrFcdData devid 1 transid 616951 /dev/xvdt
Nov 23 17:38:30 ip-10-0-1-123 kernel: [605948.575945] blkfront: xvdy: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
Nov 23 17:38:30 ip-10-0-1-123 kernel: [605948.624099]  xvdy: unknown partition table
Nov 23 17:38:30 ip-10-0-1-123 kernel: [605948.944109] btrfs: device label BtrFcdData devid 2 transid 616951 /dev/xvdy
Nov 23 17:38:30 ip-10-0-1-123 kernel: [605948.946964] btrfs: device label BtrFcdData devid 2 transid 616951 /dev/xvdy
Nov 23 17:38:31 ip-10-0-1-123 kernel: [605949.783777] blkfront: xvdu: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
Nov 23 17:38:31 ip-10-0-1-123 kernel: [605949.839874]  xvdu: unknown partition table
Nov 23 17:38:32 ip-10-0-1-123 kernel: [605950.260981] btrfs: device label BtrFcdData devid 3 transid 616951 /dev/xvdu
Nov 23 17:38:32 ip-10-0-1-123 kernel: [605950.263252] btrfs: device label BtrFcdData devid 3 transid 616951 /dev/xvdu
Nov 23 17:38:33 ip-10-0-1-123 kernel: [605951.590060] blkfront: xvdo: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled;
Nov 23 17:38:33 ip-10-0-1-123 kernel: [605951.662633]  xvdo: unknown partition table
Nov 23 17:38:33 ip-10-0-1-123 kernel: [605951.950477] btrfs: device label BtrFcdData devid 4 transid 616951 /dev/xvdo
Nov 23 17:38:33 ip-10-0-1-123 kernel: [605951.953476] btrfs: device label BtrFcdData devid 4 transid 616951 /dev/xvdo
Nov 23 17:38:35 ip-10-0-1-123 kernel: [605953.098657] btrfs: device label BtrFcdData devid 1 transid 616951 /dev/xvdt
Nov 23 17:38:35 ip-10-0-1-123 kernel: [605953.099002] btrfs: device label BtrFcdData devid 2 transid 616951 /dev/xvdy
Nov 23 17:38:35 ip-10-0-1-123 kernel: [605953.099292] btrfs: device label BtrFcdData devid 3 transid 616951 /dev/xvdu
Nov 23 17:38:35 ip-10-0-1-123 kernel: [605953.099723] btrfs: device label BtrFcdData devid 4 transid 616951 /dev/xvdo
Nov 23 17:38:35 ip-10-0-1-123 kernel: [605953.135590] btrfs: device label BtrFcdData devid 4 transid 616951 /dev/xvdo
Nov 23 17:38:35 ip-10-0-1-123 kernel: [605953.137944] btrfs: disabling disk space caching
Nov 23 17:38:35 ip-10-0-1-123 kernel: [605953.137948] btrfs: force clearing of disk cache
Nov 23 17:38:36 ip-10-0-1-123 kernel: [605954.947400] btrfs: device label BtrFcdData devid 4 transid 616951 /dev/xvdo
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.868106] INFO: task mount:12477 blocked for more than 120 seconds.
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.871838]       Not tainted 3.13.0-92-generic #139-Ubuntu
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.874879] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878538] mount           D ffff88020fc13180     0 12477   7218 0x00000000
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878543]  ffff88016d32bc18 0000000000000086 ffff88009bb8e000 0000000000013180
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878547]  ffff88016d32bfd8 0000000000013180 ffff88009bb8e000 ffff88009bb8e000
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878550]  ffff8800776ca870 ffff8800776ca878 ffffffff00000000 ffff8800776ca880
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878553] Call Trace:
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878562]  [<ffffffff8172e2e9>] schedule+0x29/0x70
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878566]  [<ffffffff81730f05>] rwsem_down_write_failed+0x115/0x230
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878571]  [<ffffffff811dd0eb>] ? iput+0x3b/0x180
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878579]  [<ffffffffa00b0000>] ? 0xffffffffa00affff
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878584]  [<ffffffff81377da3>] call_rwsem_down_write_failed+0x13/0x20
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878602]  [<ffffffffa00b51fa>] ? btrfs_mount+0x2ea/0x800 [btrfs]
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878605]  [<ffffffff8173093d>] ? down_write+0x2d/0x30
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878609]  [<ffffffff811c3c7e>] grab_super+0x2e/0xa0
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878611]  [<ffffffff811c42f0>] sget+0x2d0/0x400
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878621]  [<ffffffffa00b29a0>] ? btrfs_parse_early_options+0x1b0/0x1b0 [btrfs]
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878630]  [<ffffffffa00b5328>] btrfs_mount+0x418/0x800 [btrfs]
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878634]  [<ffffffff811735aa>] ? pcpu_alloc+0x6ca/0xa50
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878637]  [<ffffffff8119ad33>] ? alloc_pages_current+0xa3/0x160
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878641]  [<ffffffff811c5149>] mount_fs+0x39/0x1b0
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878644]  [<ffffffff811e0917>] vfs_kern_mount+0x67/0x110
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878648]  [<ffffffff811e31ef>] do_mount+0x25f/0xcd0
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878652]  [<ffffffff81156dae>] ? __get_free_pages+0xe/0x50
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878655]  [<ffffffff811e2e16>] ? copy_mount_options+0x36/0x170
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878658]  [<ffffffff811e3f53>] SyS_mount+0x83/0xc0
Nov 23 17:41:22 ip-10-0-1-123 kernel: [606120.878662]  [<ffffffff8173a9dd>] system_call_fastpath+0x1a/0x1f

答案1

如果要使用回送设备挂载多设备文件系统,仅使用 mount -o loop 是不够的。相反,您必须手动设置回送:

创建并挂载由多个磁盘映像组成的文件系统

  1. mkfs.btrfs img0 img1 img2
  2. losetup /dev/loop0 img0
  3. losetup /dev/loop1 img1
  4. losetup /dev/loop2 img2
  5. 挂载 /dev/loop0 /mnt/btrfs

相关内容