Project

General

Profile

Actions

Feature #18984

open

RFE: let rbd export write directly to a block device

Added by Ruben Kerkhof about 7 years ago. Updated almost 7 years ago.

Status:
New
Priority:
Low
Assignee:
-
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

It would be great if `rbd export` could write directly to a block device.

Right now it won't let you:
  1. rbd export fedora-25-x86_64 /dev/vgdata/lvfedora
    rbd: export error: (17) File exists

I can of course just redirect stdout, but this is quite slow. I expect this is because stdout is not seekable and writes are serialised?

$ time rbd export fedora-25-x86_64 - > /dev/vgdata/lvfedora
Exporting image: 100% complete...done.

real 0m29.704s
user 0m1.289s
sys 0m9.861s

Writing to a normal file is a lot faster:

$ time rbd export fedora-25-x86_64 /data/fedora.img
Exporting image: 100% complete...done.

real 0m6.121s
user 0m1.962s
sys 0m2.079s

Actions #1

Updated by Jason Dillaman almost 7 years ago

  • Project changed from Ceph to rbd
Actions #2

Updated by Mykola Golub almost 7 years ago

Note, write serialization is not the only difference between writing to a file and to stdout. Another difference is that when writing to file the export effectively uses lseek to skip image regions without data, while in the case of stdout zeroes are written.

When writing to a device, we can't just lseek zero regions. We need either to write zeros or use low level methods like BLKDISCARD/BLKSECDISCARD/BLKZEROOU ioctl.

This looks like doable but at this moment I am not sure if we need to bloat rbd tool for this specific optimization case.

Ruben, could you please describe your use case(s)? It could help to understand how useful this feature would be.

Actions #3

Updated by Jason Dillaman almost 7 years ago

Couldn't you just run "rbd export <image-spec> - | dd of=/dev/someblockdevice" and achieve the desired outcome?

Actions #4

Updated by Ruben Kerkhof almost 7 years ago

Mykola Golub wrote:

Note, write serialization is not the only difference between writing to a file and to stdout. Another difference is that when writing to file the export effectively uses lseek to skip image regions without data, while in the case of stdout zeroes are written.

When writing to a device, we can't just lseek zero regions. We need either to write zeros or use low level methods like BLKDISCARD/BLKSECDISCARD/BLKZEROOU ioctl.

This looks like doable but at this moment I am not sure if we need to bloat rbd tool for this specific optimization case.

Ruben, could you please describe your use case(s)? It could help to understand how useful this feature would be.

We run vms on local storage, and store (lvm-based) snapshots of these vms in Ceph using rbd import/export.

Actions #5

Updated by Ruben Kerkhof almost 7 years ago

Jason Dillaman wrote:

Couldn't you just run "rbd export <image-spec> - | dd of=/dev/someblockdevice" and achieve the desired outcome?

Yes, that's we do now, it's still quite a bit slower though.

Actions

Also available in: Atom PDF