Skip to contentSkip to conversation

qemu drive-mirror to rbd storage : no sparse rbd image

DISCUSSION Alexandre DERUMIER 4 participants 11 messages Oct 8, 2014 – Oct 13, 2014 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 54c55fc6-b12a-42e5-b99d-9752c8a9b19b@mailpro

#1 lore raw

Hi,

I'm currently planning to migrate our storage to ceph/rbd through qemu drive-mirror

and It seem that drive-mirror with rbd block driver, don't create a sparse image. (all zeros are copied to the target rbd).

Also note, that it's working fine with "qemu-img convert" , the rbd volume is sparse after conversion.

Could it be related to the "bdrv_co_write_zeroes" missing features in block/rbd.c ?

(It's available in other block drivers (scsi,gluster,raw-aio) , and I don't have this problem with theses block drivers).

Regards,

Alexandre Derumier

#2 lore raw
Quoted 7 lines · Alexandre DERUMIER

Hi,

I'm currently planning to migrate our storage to ceph/rbd through qemu drive-mirror

and It seem that drive-mirror with rbd block driver, don't create a sparse image. (all zeros are copied to the target rbd).

Also note, that it's working fine with "qemu-img convert" , the rbd volume is sparse after conversion.

What is the source format? If the zero clusters are actually unallocated in the source image, drive-mirror will not write those clusters either. I.e. with "drive-mirror sync=top", both source and target should have the same "qemu-img map" output.

Fam

Quoted 14 lines

Could it be related to the "bdrv_co_write_zeroes" missing features in block/rbd.c ?

(It's available in other block drivers (scsi,gluster,raw-aio) , and I don't have this problem with theses block drivers).

Regards,

Alexandre Derumier

#3 lore raw
Quoted 4 lines
Quoted 4 lines

What is the source format? If the zero clusters are actually unallocated in the source image, drive-mirror will not write those clusters either. I.e. with "drive-mirror sync=top", both source and target should have the same "qemu-img map" output.

Thanks for your reply,

I had tried drive mirror (sync=full) with

raw file (sparse) -> rbd (no sparse)
rbd (sparse) -> rbd (no sparse)
raw file (sparse) -> qcow2 on ext4 (sparse)
rbd (sparse) -> raw on ext4 (sparse)

Also I see that I have the same problem with target file format on xfs.

raw file (sparse) -> qcow2 on xfs (no sparse)
rbd (sparse) -> raw on xfs (no sparse)

I only have this problem with drive-mirror, qemu-img convert seem to simply skip zero blocks.

Or maybe this is because I'm using sync=full ?

What is the difference between full and top ?

""sync": what parts of the disk image should be copied to the destination;
possibilities include "full" for all the disk, "top" for only the sectors allocated in the topmost image".

(what is topmost image ?)

----- Mail original -----

De: "Fam Zheng" <[email protected]>
À: "Alexandre DERUMIER" <[email protected]>
Cc: "qemu-devel" <[email protected]>, "Ceph Devel" <[email protected]> Envoyé: Samedi 11 Octobre 2014 09:01:18
Objet: Re: [Qemu-devel] qemu drive-mirror to rbd storage : no sparse rbd image

Quoted 7 lines · Alexandre DERUMIER

Hi,

I'm currently planning to migrate our storage to ceph/rbd through qemu drive-mirror

and It seem that drive-mirror with rbd block driver, don't create a sparse image. (all zeros are copied to the target rbd).

Also note, that it's working fine with "qemu-img convert" , the rbd volume is sparse after conversion.

What is the source format? If the zero clusters are actually unallocated in the source image, drive-mirror will not write those clusters either. I.e. with "drive-mirror sync=top", both source and target should have the same "qemu-img map" output.

Fam

Quoted 4 lines

Could it be related to the "bdrv_co_write_zeroes" missing features in block/rbd.c ?

Quoted 10 lines

(It's available in other block drivers (scsi,gluster,raw-aio) , and I don't have this problem with theses block drivers).

Regards,

Alexandre Derumier

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 14 lines · Alexandre DERUMIER
Quoted 4 lines
Quoted 4 lines

What is the source format? If the zero clusters are actually unallocated in the source image, drive-mirror will not write those clusters either. I.e. with "drive-mirror sync=top", both source and target should have the same "qemu-img map" output.

Thanks for your reply,

I had tried drive mirror (sync=full) with

raw file (sparse) -> rbd (no sparse) rbd (sparse) -> rbd (no sparse)
raw file (sparse) -> qcow2 on ext4 (sparse) rbd (sparse) -> raw on ext4 (sparse)

Quoted 5 lines

Also I see that I have the same problem with target file format on xfs.

raw file (sparse) -> qcow2 on xfs (no sparse) rbd (sparse) -> raw on xfs (no sparse)

These don't tell me much. Maybe it's better to show the actual commands and how you tell sparse from no sparse?

Does "qcow2 -> qcow2" work for you on xfs?

Quoted 6 lines

I only have this problem with drive-mirror, qemu-img convert seem to simply skip zero blocks.

Or maybe this is because I'm using sync=full ?

Quoted 7 lines

What is the difference between full and top ?

""sync": what parts of the disk image should be copied to the destination;
possibilities include "full" for all the disk, "top" for only the sectors allocated in the topmost image".

(what is topmost image ?)

For "sync=top", only the clusters allocated in the image itself is copied; for "full", all those clusters allocated in the image itself, and its backing image, and it's backing's backing image, ..., are copied.

The image itself, having a backing image or not, is called the topmost image.

Fam

#5 lore raw
Quoted 40 lines · Fam Zheng
Quoted 14 lines · Alexandre DERUMIER
Quoted 4 lines
Quoted 4 lines

What is the source format? If the zero clusters are actually unallocated in the source image, drive-mirror will not write those clusters either. I.e. with "drive-mirror sync=top", both source and target should have the same "qemu-img map" output.

Thanks for your reply,

I had tried drive mirror (sync=full) with

raw file (sparse) -> rbd (no sparse) rbd (sparse) -> rbd (no sparse)
raw file (sparse) -> qcow2 on ext4 (sparse) rbd (sparse) -> raw on ext4 (sparse)

Quoted 5 lines

Also I see that I have the same problem with target file format on xfs.

raw file (sparse) -> qcow2 on xfs (no sparse) rbd (sparse) -> raw on xfs (no sparse)

These don't tell me much. Maybe it's better to show the actual commands and how you tell sparse from no sparse?

Does "qcow2 -> qcow2" work for you on xfs?

Quoted 6 lines

I only have this problem with drive-mirror, qemu-img convert seem to simply skip zero blocks.

Or maybe this is because I'm using sync=full ?

Quoted 7 lines

What is the difference between full and top ?

""sync": what parts of the disk image should be copied to the destination;
possibilities include "full" for all the disk, "top" for only the sectors allocated in the topmost image".

(what is topmost image ?)

Quoted 8 lines

For "sync=top", only the clusters allocated in the image itself is copied; for "full", all those clusters allocated in the image itself, and its backing image, and it's backing's backing image, ..., are copied.

The image itself, having a backing image or not, is called the topmost image.

Fam
--

Just a wild guess - Alexandre, did you tried detect-zeroes blk option for mirroring targets?

#6 lore raw
Quoted 2 lines
Quoted 2 lines

Just a wild guess - Alexandre, did you tried detect-zeroes blk option for mirroring targets?

Hi, yes, I have also tried with detect-zeroes (on or discard) with virtio and virtio-scsi, doesn't help. (I'm not sure that is implemtend in drive-mirror).

As workaround currently, after drive-mirror, I doing fstrim inside the guest (with virtio-scsi + discard), and like this I can free space on rbd storage.

----- Mail original -----

De: "Andrey Korolyov" <[email protected]>
À: "Fam Zheng" <[email protected]>
Cc: "Alexandre DERUMIER" <[email protected]>, "qemu-devel" <[email protected]>, "Ceph Devel" <[email protected]> Envoyé: Samedi 11 Octobre 2014 10:30:40
Objet: Re: [Qemu-devel] qemu drive-mirror to rbd storage : no sparse rbd image

Quoted 40 lines · Fam Zheng
Quoted 14 lines · Alexandre DERUMIER
Quoted 4 lines
Quoted 4 lines

What is the source format? If the zero clusters are actually unallocated in the source image, drive-mirror will not write those clusters either. I.e. with "drive-mirror sync=top", both source and target should have the same "qemu-img map" output.

Thanks for your reply,

I had tried drive mirror (sync=full) with

raw file (sparse) -> rbd (no sparse)
rbd (sparse) -> rbd (no sparse)
raw file (sparse) -> qcow2 on ext4 (sparse)
rbd (sparse) -> raw on ext4 (sparse)

Quoted 5 lines

Also I see that I have the same problem with target file format on xfs.

raw file (sparse) -> qcow2 on xfs (no sparse)
rbd (sparse) -> raw on xfs (no sparse)

These don't tell me much. Maybe it's better to show the actual commands and how you tell sparse from no sparse?

Does "qcow2 -> qcow2" work for you on xfs?

Quoted 6 lines

I only have this problem with drive-mirror, qemu-img convert seem to simply skip zero blocks.

Or maybe this is because I'm using sync=full ?

Quoted 7 lines

What is the difference between full and top ?

""sync": what parts of the disk image should be copied to the destination; possibilities include "full" for all the disk, "top" for only the sectors allocated in the topmost image".

(what is topmost image ?)

Quoted 8 lines

For "sync=top", only the clusters allocated in the image itself is copied; for "full", all those clusters allocated in the image itself, and its backing image, and it's backing's backing image, ..., are copied.

The image itself, having a backing image or not, is called the topmost image.

Fam

Just a wild guess - Alexandre, did you tried detect-zeroes blk option for mirroring targets?
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
In reply to Fam Zheng
Quoted 2 lines
Quoted 2 lines

These don't tell me much. Maybe it's better to show the actual commands and how you tell sparse from no sparse?

Well,

I create 2 empty source images files of 10G. (source.qcow2 and source.raw)

then:

du -sh source.qcow2 : 2M
du -sh source.raw : 0M

then I convert them with qemu-img convert : (source.qcow2 -> target.qcow2 , source.raw -> target.raw)

du -sh target.qcow2 : 2M
du -sh target.raw : 0M

(So it's ok here)

But If I convert them with drive-mirror:

du -sh target.qcow2 : 11G
du -sh target.raw : 11G

I have also double check with #df, and I see space allocated on filesystem when using drive-mirror.

I have the same behavior if target is a rbd storage.

Also I have done test again ext3,ext4, and I see the same problem than with xfs.

I'm pretty sure that drive-mirror copy zero block, qemu-img convert take around 2s to convert the empty file (because it's skipping zero block), and drive mirror take around 5min.

----- Mail original -----

De: "Fam Zheng" <[email protected]>
À: "Alexandre DERUMIER" <[email protected]>
Cc: "qemu-devel" <[email protected]>, "Ceph Devel" <[email protected]> Envoyé: Samedi 11 Octobre 2014 10:25:35
Objet: Re: [Qemu-devel] qemu drive-mirror to rbd storage : no sparse rbd image

Quoted 14 lines · Alexandre DERUMIER
Quoted 4 lines
Quoted 4 lines

What is the source format? If the zero clusters are actually unallocated in the source image, drive-mirror will not write those clusters either. I.e. with "drive-mirror sync=top", both source and target should have the same "qemu-img map" output.

Thanks for your reply,

I had tried drive mirror (sync=full) with

raw file (sparse) -> rbd (no sparse)
rbd (sparse) -> rbd (no sparse)
raw file (sparse) -> qcow2 on ext4 (sparse)
rbd (sparse) -> raw on ext4 (sparse)

Quoted 5 lines

Also I see that I have the same problem with target file format on xfs.

raw file (sparse) -> qcow2 on xfs (no sparse)
rbd (sparse) -> raw on xfs (no sparse)

These don't tell me much. Maybe it's better to show the actual commands and how you tell sparse from no sparse?

Does "qcow2 -> qcow2" work for you on xfs?

Quoted 6 lines

I only have this problem with drive-mirror, qemu-img convert seem to simply skip zero blocks.

Or maybe this is because I'm using sync=full ?

Quoted 7 lines

What is the difference between full and top ?

""sync": what parts of the disk image should be copied to the destination; possibilities include "full" for all the disk, "top" for only the sectors allocated in the topmost image".

(what is topmost image ?)

For "sync=top", only the clusters allocated in the image itself is copied; for "full", all those clusters allocated in the image itself, and its backing image, and it's backing's backing image, ..., are copied.

The image itself, having a backing image or not, is called the topmost image.

Fam
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
In reply to Alexandre DERUMIER

Il 08/10/2014 13:15, Alexandre DERUMIER ha scritto:

Quoted 4 lines

Hi,

I'm currently planning to migrate our storage to ceph/rbd through qemu drive-mirror

Quoted 8 lines

and It seem that drive-mirror with rbd block driver, don't create a sparse image. (all zeros are copied to the target rbd).

Also note, that it's working fine with "qemu-img convert" , the rbd volume is sparse after conversion.

Could it be related to the "bdrv_co_write_zeroes" missing features in block/rbd.c ?

(It's available in other block drivers (scsi,gluster,raw-aio) , and I don't have this problem with theses block drivers).

Lack of bdrv_co_write_zeroes is why detect-zeroes does not work.

Lack of bdrv_get_block_status is why sparse->sparse does not work without detect-zeroes.

Paolo

#9 lore raw
Quoted 4 lines
Quoted 4 lines

Lack of bdrv_co_write_zeroes is why detect-zeroes does not work.

Lack of bdrv_get_block_status is why sparse->sparse does not work without detect-zeroes.

Ok, thanks Paolo !

Both are missing in rbd block driver. @ceph-devel . Could it be possible to implement them ?

Also, about drive-mirror, I had tried with detect-zeroes with simple qcow2 file, and It don't seem to help.
I'm not sure that detect-zeroes is implement in drive-mirror.

also, the target mirrored volume don't seem to have the detect-zeroes option

# info block
drive-virtio1: /source.qcow2 (qcow2)
    Detect zeroes:    on

#du -sh source.qcow2 : 2M

drive-mirror source.qcow2 -> target.qcow2

# info block
drive-virtio1: /target.qcow2 (qcow2)

#du -sh target.qcow2 : 11G

----- Mail original -----

De: "Paolo Bonzini" <[email protected]>
À: "Alexandre DERUMIER" <[email protected]>, "qemu-devel" <[email protected]>
Cc: "Ceph Devel" <[email protected]>
Envoyé: Dimanche 12 Octobre 2014 15:02:12
Objet: Re: qemu drive-mirror to rbd storage : no sparse rbd image

Il 08/10/2014 13:15, Alexandre DERUMIER ha scritto:

Quoted 4 lines

Hi,

I'm currently planning to migrate our storage to ceph/rbd through qemu drive-mirror

Quoted 8 lines

and It seem that drive-mirror with rbd block driver, don't create a sparse image. (all zeros are copied to the target rbd).

Also note, that it's working fine with "qemu-img convert" , the rbd volume is sparse after conversion.

Could it be related to the "bdrv_co_write_zeroes" missing features in block/rbd.c ?

(It's available in other block drivers (scsi,gluster,raw-aio) , and I don't have this problem with theses block drivers).

Lack of bdrv_co_write_zeroes is why detect-zeroes does not work.

Lack of bdrv_get_block_status is why sparse->sparse does not work without detect-zeroes.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Il 13/10/2014 08:06, Alexandre DERUMIER ha scritto:

Quoted 12 lines

Also, about drive-mirror, I had tried with detect-zeroes with simple qcow2 file, and It don't seem to help.
I'm not sure that detect-zeroes is implement in drive-mirror.

also, the target mirrored volume don't seem to have the detect-zeroes option

# info block
drive-virtio1: /source.qcow2 (qcow2)
    Detect zeroes:    on
Quoted 9 lines

#du -sh source.qcow2 : 2M

drive-mirror source.qcow2 -> target.qcow2

# info block
drive-virtio1: /target.qcow2 (qcow2)

#du -sh target.qcow2 : 11G

Ah, you're right. We need to add an options field, or use a new blockdev-mirror command.

Paolo

#11 lore raw
Quoted 2 lines
Quoted 2 lines

Ah, you're right. We need to add an options field, or use a new blockdev-mirror command.

Ok, thanks. Can't help to implement this, but I'll glad to help for testing.

----- Mail original -----

De: "Paolo Bonzini" <[email protected]>
À: "Alexandre DERUMIER" <[email protected]>
Cc: "Ceph Devel" <[email protected]>, "qemu-devel" <[email protected]> Envoyé: Lundi 13 Octobre 2014 09:06:01
Objet: Re: qemu drive-mirror to rbd storage : no sparse rbd image

Il 13/10/2014 08:06, Alexandre DERUMIER ha scritto:

Quoted 12 lines

Also, about drive-mirror, I had tried with detect-zeroes with simple qcow2 file, and It don't seem to help.
I'm not sure that detect-zeroes is implement in drive-mirror.

also, the target mirrored volume don't seem to have the detect-zeroes option

# info block 
drive-virtio1: /source.qcow2 (qcow2) 
Detect zeroes: on 
Quoted 9 lines

#du -sh source.qcow2 : 2M

drive-mirror source.qcow2 -> target.qcow2

# info block 
drive-virtio1: /target.qcow2 (qcow2) 

#du -sh target.qcow2 : 11G

Ah, you're right. We need to add an options field, or use a new blockdev-mirror command.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html