ceph命令行

[root@xgto01c010243134009 ceph]# rbd --help
usage: rbd [-n <auth user>] [OPTIONS] <cmd> ...
where 'pool' is a rados pool name (default is 'rbd') and 'cmd' is one of:
  (ls | list) [-l | --long ] [pool-name] list rbd images
                                              (-l includes snapshots/clones)
  info <image-name>                           show information about image size,
                                              striping, etc.
  create [--order <bits>] [--image-features <features>] [--image-shared]
         --size <MB> <name>                   create an empty image
  clone [--order <bits>] [--image-features <features>] [--image-shared]
        <parentsnap> <clonename>              clone a snapshot into a COW
                                              child image
  children <snap-name>                        display children of snapshot
  flatten <image-name>                        fill clone with parent data
                                              (make it independent)
  resize --size <MB> <image-name>             resize (expand or contract) image
  rm <image-name>                             delete an image
  export <image-name> <path>                  export image to file
                                              "-" for stdout
  import [--image-features <features>] [--image-shared]
         <path> <image-name>                  import image from file (dest
                                              defaults as the filename part
                                              of file). "-" for stdin
  diff <image-name> [--from-snap <snap-name>] print extents that differ since
                                              a previous snap, or image creation
  export-diff <image-name> [--from-snap <snap-name>] <path>
                                              export an incremental diff to
                                              path, or "-" for stdout
  merge-diff <diff1> <diff2> <path>           merge <diff1> and <diff2> into
                                              <path>, <diff1> could be "-"
                                              for stdin, and <path> could be "-"
                                              for stdout
  import-diff <path> <image-name>             import an incremental diff from
                                              path or "-" for stdin
  (cp | copy) <src> <dest>                    copy src image to dest
  (mv | rename) <src> <dest>                  rename src image to dest
  snap ls <image-name>                        dump list of image snapshots
  snap create <snap-name>                     create a snapshot
  snap rollback <snap-name>                   rollback image to snapshot
  snap rm <snap-name>                         deletes a snapshot
  snap purge <image-name>                     deletes all snapshots
  snap protect <snap-name>                    prevent a snapshot from being deleted
  snap unprotect <snap-name>                  allow a snapshot to be deleted
  watch <image-name>                          watch events on image
  status <image-name>                         show the status of this image
  map <image-name>                            map image to a block device
                                              using the kernel
  unmap <device>                              unmap a rbd device that was
                                              mapped by the kernel
  showmapped                                  show the rbd images mapped
                                              by the kernel
  lock list <image-name>                      show locks held on an image
  lock add <image-name> <id> [--shared <tag>] take a lock called id on an image
  lock remove <image-name> <id> <locker>      release a lock on an image
  bench-write <image-name>                    simple write benchmark
                 --io-size <bytes>              write size
                 --io-threads <num>             ios in flight
                 --io-total <bytes>             total bytes to write
                 --io-pattern <seq|rand>        write pattern

样例:

检索映像信息
用下列命令检索某个特定映像的信息,用映像名字替换 {image-name} :

rbd info {image-name}
例如:

rbd info foo
用下列命令检索某存储池内的映像的信息,用映像名字替换 {image-name} 、用存储池名字替换 {pool-name} :

rbd info {pool-name}/{image-name}
例如:

[root@test ceph]# rbd info nova/2b105eef-e19d-494d-b15e-cb334db2a3c7_disk
rbd image '2b105eef-e19d-494d-b15e-cb334db2a3c7_disk':
	size 51200 MB in 12800 objects
	order 22 (4096 kB objects)
	block_name_prefix: rbd_data.1a0df3f2ae8944a
	format: 2
	features: layering
	flags: 

查看pool的信息 ceph osd lspools

[root@test ~]# ceph osd lspools 查看pool
0 rbd,1 nova,2 cinder,3 glance,  

查看pool里面的内容 rbd ls nova

[root@test ~]# rbd ls nova 查看nova pool里面的内容
3135fd37-0231-4e6f-a90c-bc90971f8ec1_disk
47b63134-8d32-4382-850c-9a64ebb1b6b0_disk
5734d41d-3c9a-4638-808c-c5755a7cfef4_disk
7a99169e2c87223802ed55f856b369ed5e174001_disk
da1a7f6c-7702-4d6b-86c7-231d322c6565_disk
018a0ead-6d7a-4532-b05c-19cad1ce662f_disk
018a0ead-6d7a-4532-b05c-19cad1ce662f_disk.config
0203f6f3-168d-4a64-bf35-e18c016cc58a_disk
0203f6f3-168d-4a64-bf35-e18c016cc58a_disk.config

 查看某一个镜像的快照信息rbd snap ls cinder/volume-0fa87427-bfe6-40af-9960-2980bcf05091  

[root@xgto01c010243134009 snapshots]# rbd snap ls cinder/volume-0fa87427-bfe6-40af-9960-2980bcf05091
SNAPID NAME                                             SIZE 
    37 snapshot-8a57243f-66d9-447f-b624-d2b73eeeba56 2048 MB 
[root@xgto01c010243134009 snapshots]# 

  

 

 

原文地址:https://www.cnblogs.com/potato-chip/p/13632617.html