ETCD Backup Failing With Error Message "Error: could not rename /root/etcd_backup0/.part"
Problem
ETCD backup is failing with the error mentioned below.
# ETCDCTL_API=3 etcdctl snapshot save /root/etcd_backup0/{"level":"info","ts":1666284121.098649,"caller":"snapshot/v3_snapshot.go:119","msg":"created temporary db file","path":"/root/etcd_backup0/.part"}{"level":"info","ts":"2022-10-20T16:42:01.100Z","caller":"clientv3/maintenance.go:200","msg":"opened snapshot stream; downloading"}{"level":"info","ts":1666284121.10057,"caller":"snapshot/v3_snapshot.go:127","msg":"fetching snapshot","endpoint":"127.0.0.1:2379"}{"level":"info","ts":"2022-10-20T16:42:01.600Z","caller":"clientv3/maintenance.go:208","msg":"completed snapshot read; closing"}{"level":"info","ts":1666284121.6521926,"caller":"snapshot/v3_snapshot.go:142","msg":"fetched snapshot","endpoint":"127.0.0.1:2379","size":"18 MB","took":0.553370829}Error: could not rename /root/etcd_backup0/.part to /root/etcd_backup0/ (rename /root/etcd_backup0/.part /root/etcd_backup0/: file exists)Environment
- Platform9 Managed Kubernetes – All Versions
Cause
- The ETCD DB backup command mentioned below was intended to save the ETCD snapshot backup file under
/root/etcd_backup0/directory.
# ETCDCTL_API=3 etcdctl snapshot save /root/etcd_backup0/- But Instead of that , the
/root/etcd_backup0/is considered as the Database snapshot backup file name. - Since a directory with that name is already present hence it is failing to take backup.
Resolution
- ETCD backup command expects a file name as an argument which will be used to save the snapshot DB backup.
- Hence the ETCD backup command should always have the ETCD snapshot DB backup file name mention in it. For Example,
ETCDCTL_API=3 etcdctl snapshot save $HOME/etcd-backup-snapshot-$(date +%s).dbWas this page helpful?