There are differences in sparse files of PVC clones on different operating systems
905049079 opened this issue · 2 comments
v1.15.0 version : When I clone PVC, if the source PVC data is large, I will not copy sparse files on CentOS 7, but the entire PVC data. Here is my operation record
[root@host1 csi-hostpath-data]# du -sh ./*
13G ./30ddc477-9b4e-11ef-8bac-426f9cf00e68
4.0K ./state.json
[root@host1 csi-hostpath-data]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
kubevirt-centos7-compress-init-host1.rongqin.edu Bound pvc-69756e7c-2ed3-4146-8d00-c0a4ec2655cd 40Gi RWX host1.rongqin.edu 6m9s
[root@host1 csi-hostpath-data]# cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test
namespace: default
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 40Gi
dataSource:
name: kubevirt-centos7-compress-init-host1.rongqin.edu
kind: PersistentVolumeClaim
storageClassName: host1.rongqin.edu
EOF
sleep 1
kubectl get pvc
du -sh ./*persistentvolumeclaim/test created
[root@host1 csi-hostpath-data]# sleep 1
[root@host1 csi-hostpath-data]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
kubevirt-centos7-compress-init-host1.rongqin.edu Bound pvc-69756e7c-2ed3-4146-8d00-c0a4ec2655cd 40Gi RWX host1.rongqin.edu 6m18s
test Pending host1.rongqin.edu 1s
[root@host1 csi-hostpath-data]# du -sh ./*
290M ./0f91de54-9b4f-11ef-8bac-426f9cf00e68
13G ./30ddc477-9b4e-11ef-8bac-426f9cf00e68
4.0K ./state.json
[root@host1 csi-hostpath-data]# du -sh ./*
858M ./0f91de54-9b4f-11ef-8bac-426f9cf00e68
13G ./30ddc477-9b4e-11ef-8bac-426f9cf00e68
4.0K ./state.json
[root@host1 csi-hostpath-data]# du -sh ./*
1.4G ./0f91de54-9b4f-11ef-8bac-426f9cf00e68
13G ./30ddc477-9b4e-11ef-8bac-426f9cf00e68
4.0K ./state.json
[root@host1 csi-hostpath-data]# kubectl describe pvc test
Name: test
Namespace: default
....................
Events:
Type Reason Age From Message
Warning ProvisioningFailed 8s host1.rongqin.edu_csi-hostpathplugin-host1-0_7fb228c5-4d0c-412d-a8a4-6a6336185068 failed to provision volume with StorageClass "host1.rongqin.edu": rpc error: code = DeadlineExceeded desc = context deadline exceeded
Normal Provisioning 7s (x2 over 18s) host1.rongqin.edu_csi-hostpathplugin-host1-0_7fb228c5-4d0c-412d-a8a4-6a6336185068 External provisioner is provisioning volume for claim "default/test"
Normal ExternalProvisioning 1s (x4 over 18s) persistentvolume-controller waiting for a volume to be created, either by external provisioner "host1.rongqin.edu" or manually created by system administrator
[root@host1 csi-hostpath-data]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@host1 csi-hostpath-data]# uname -a
Linux host1.rongqin.edu 6.9.7-1.el7.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 27 10:58:15 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux
After my testing, CentOS Stream 8 and CentOS Stream 9 are normal, and Ubuntu 22 and Debian 12 are also the same as CentOS 7
The following is the process of cloning and copying sparse files using CentOS Stream 8 and CentOS Stream 9
centos stream 8
[root@host1 csi-hostpath-data]# du -sh ./*
13G ./7dbc03d4-982f-11ef-b1aa-166cfc72d4ce
4.0K ./state.json
[root@host1 csi-hostpath-data]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
kubevirt-centos7-compress-init-host1.rongqin.edu Bound pvc-121bab16-8a2a-450a-adfa-2189b44d6eda 40Gi RWX host1.rongqin.edu 3d22h
[root@host1 csi-hostpath-data]# cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test
namespace: default
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 40Gi
dataSource:
name: kubevirt-centos7-compress-init-host1.rongqin.edu
kind: PersistentVolumeClaim
storageClassName: host1.rongqin.edu
EOF
sleep 1
kubectl get pvc
du -sh ./*persistentvolumeclaim/test created
[root@host1 csi-hostpath-data]# sleep 1
[root@host1 csi-hostpath-data]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
kubevirt-centos7-compress-init-host1.rongqin.edu Bound pvc-121bab16-8a2a-450a-adfa-2189b44d6eda 40Gi RWX host1.rongqin.edu 3d22h
test Bound pvc-9768418b-dea1-4663-9a2e-ea484c7a3c57 40Gi RWX host1.rongqin.edu 1s
[root@host1 csi-hostpath-data]# du -sh ./*
13G ./6a08524a-9b49-11ef-b034-265f9a662c7d
13G ./7dbc03d4-982f-11ef-b1aa-166cfc72d4ce
4.0K ./state.json
[root@host1 csi-hostpath-data]#
[root@host1 csi-hostpath-data]#
[root@host1 csi-hostpath-data]# cat /etc/redhat-release
CentOS Stream release 8
[root@host1 csi-hostpath-data]# kubectl get node
NAME STATUS ROLES AGE VERSION
host1.rongqin.edu Ready master,work 39d v1.26.10
centos stream 9
[root@host1 ~]# cd /var/lib/csi-hostpath-data/
[root@host1 csi-hostpath-data]# ll
总用量 4
drwxrwsr-x 2 root 107 22 11月 5 15:04 e42f0b03-9b43-11ef-9d4e-f2038ed56599
-rw------- 1 root root 416 11月 5 15:30 state.json
[root@host1 csi-hostpath-data]# du -sh ./*
13G ./e42f0b03-9b43-11ef-9d4e-f2038ed56599
4.0K ./state.json
[root@host1 csi-hostpath-data]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
kubevirt-centos7-compress-init-host1.rongqin.edu Bound pvc-52680969-ab06-4157-9ba1-29ec9ad8bf85 40Gi RWX host1.rongqin.edu 28m
[root@host1 csi-hostpath-data]#
[root@host1 csi-hostpath-data]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
kubevirt-centos7-compress-init-host1.rongqin.edu Bound pvc-52680969-ab06-4157-9ba1-29ec9ad8bf85 40Gi RWX host1.rongqin.edu 28m
[root@host1 csi-hostpath-data]# du -sh ./*
13G ./e42f0b03-9b43-11ef-9d4e-f2038ed56599
4.0K ./state.json
[root@host1 csi-hostpath-data]# cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test
namespace: default
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 40Gi
dataSource:
name: kubevirt-centos7-compress-init-host1.rongqin.edu
kind: PersistentVolumeClaim
storageClassName: host1.rongqin.edu
EOF
sleep 1
kubectl get pvc
du -sh ./*persistentvolumeclaim/test created
[root@host1 csi-hostpath-data]# sleep 1
[root@host1 csi-hostpath-data]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
kubevirt-centos7-compress-init-host1.rongqin.edu Bound pvc-52680969-ab06-4157-9ba1-29ec9ad8bf85 40Gi RWX host1.rongqin.edu 29m
test Bound pvc-14153ddd-dc06-4d02-ba04-1ddd19c8e696 40Gi RWX host1.rongqin.edu 1s
[root@host1 csi-hostpath-data]# du -sh ./*
13G ./e42f0b03-9b43-11ef-9d4e-f2038ed56599
13G ./f55a8a04-9b47-11ef-9d4e-f2038ed56599
4.0K ./state.json
[root@host1 csi-hostpath-data]# cat /etc/redhat-release
CentOS Stream release 9
[root@host1 csi-hostpath-data]# kubectl get node
NAME STATUS ROLES AGE VERSION
host1.rongqin.edu Ready master,work 38m v1.26.15
csi-hostpath version: v1.15.0