Re: RBD export format for start and end snapshots

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 12, 2016 at 12:09 PM, Josh Durgin <jdurgin@xxxxxxxxxx> wrote:
On 01/12/2016 06:10 AM, Alex Gorbachev wrote:
Good day!  I am working on a robust backup script for RBD and ran into a
need to reliably determine start and end snapshots for differential
exports (done with rbd export-diff).

I can clearly see these if dumping the ASCII header of the export file,
e.g.:

iss@lab2-b1:/data/volume1$ strings
exp-tst1-spin1-sctst1-0111-174938-2016-cons-thin.scexp|head -3
rbd diff v1
auto-0111-083856-2016-tst1t
auto-0111-174856-2016-tst1s

It appears that "auto-0111-083856-2016-tst1" is the start snapshot
(followed by t) and "auto-0111-174856-2016-tst1" is the end snapshot
(followed by s).

Is this the best way to determine snapshots and are letters "s" and "t"
going to stay the same?

The format won't change in an incompatible way, so we won't use those
fields for other purposes, but 'strings | head -3' might not always
work if we add fields or have longer strings later.

The format is documented here:

http://docs.ceph.com/docs/master/dev/rbd-diff/

It'd be more reliable if you decoded it by unpacking the diff with
your language of choice (e.g. using https://docs.python.org/2/library/struct.html for python.)

Josh

Thanks Josh.  I implemented in Perl as:

my $buffer = 4096; # read first 4KB
open(FILE,'<',"$file");
sysread(FILE,$data,$buffer);
@str = unpack("A12 a1 L/A* a1 L/A* a1 Q",$data);

This assumes that the first characted line "rbd diff v1\n” is always 12 bytes long

Best regards,
Alex

_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux