To be a better coder
分类: LINUX
2020-08-24 10:07:40
# tar zcSf file.img.tar.gz file.img
# tar zvxf file.img.tar.gz # du file.img -h 3.5G file.img
# du file.img -h 30G file.img # cp --sparse=always file.img file.img.sparse # du file.img.sparse -h 3.5G file.img.sparse
[root@localhost bbb]#
[root@localhost bbb]# qemu-img info venus-vjy-x86_64
image: venus-vjy-x86_64
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 5.5G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
[root@localhost bbb]# cp --sqarse=always venus-vjy-x86_64 venus-vjy-x86_64.sparse
cp: unrecognized option '--sqarse=always'
Try 'cp --help' for more information.
[root@localhost bbb]# cp --sparse=always venus-vjy-x86_64 venus-vjy-x86_64.sparse
[root@localhost bbb]#
[root@localhost bbb]#
[root@localhost bbb]# ls
bbb.xml disk venus-vjy-x86_64 venus-vjy-x86_64.sparse vmInfo.sql
[root@localhost bbb]#
[root@localhost bbb]#
[root@localhost bbb]# qemu-img info venus-vjy-x86_64.sparse
image: venus-vjy-x86_64.sparse
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 5.3G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
[root@localhost bbb]#
[root@localhost bbb]#
[root@localhost bbb]# ls -alh
total 11G
drwxr-xr-x 3 root root 4.0K Aug 24 09:58 .
drwxrwxrwx 4 root root 4.0K Aug 18 11:05 ..
-rw-r--r-- 1 root root 1.9K Aug 13 13:05 bbb.xml
drwxr-xr-x 2 root root 4.0K Aug 13 13:05 disk
-rw-r--r-- 1 root root 5.5G Aug 24 09:54 venus-vjy-x86_64
-rw-r--r-- 1 root root 5.5G Aug 24 09:59 venus-vjy-x86_64.sparse
-rw-rw-rw- 1 root root 11K Aug 13 13:05 vmInfo.sql
[root@localhost bbb]# qemu-img convert -f qcow2 -O qcow2 venus-vjy-x86_64.qcow2 v
venus-vjy-x86_64 venus-vjy-x86_64.sparse vmInfo.sql
[root@localhost bbb]# qemu-img convert -f qcow2 -O qcow2 venus-vjy-x86_64.qcow2 venus-vjy-x86_64.sparse
qemu-img: Could not open 'venus-vjy-x86_64.qcow2': Could not open 'venus-vjy-x86_64.qcow2': No such file or directory
[root@localhost bbb]#
[root@localhost bbb]#