tar解压出错
提示信息:
[root@hadoop1 sbin]# vim mysql_db_backup.sh
[root@hadoop1 sbin]# rm -rf /data/*
[root@hadoop1 sbin]# ./mysql_db_backup.sh
==========开始备份了============
==========备份的路径:/data/backup/db/2021_06_16_22:11:49.tar.gz
Warning: Using a password on the command line interface can be insecure.
2021_06_16_22:11:49/
2021_06_16_22:11:49/2021_06_16_22:11:49.sql.gz
^Htar (child): Cannot connect to 2021_06_16_22: resolve failed
tar: Child returned status 128
tar: Error is not recoverable: exiting now
错误信息的意思是说:
无法连接到2021_06_16_22:解析失败
这是由于压缩文件名字里面有":",所以会被识别成一个地址,此时解压缩需要使用–force-loca的参数来忽略冒号
解决办法:
#打包这个文件
cd $BACKUP
tar -zcvf $DATETIME.tar.gz $DATETIME --force-local
转置:https://blog.youkuaiyun.com/weixin_42506599/article/details/103945734
本文介绍了在Linux环境下,由于文件名包含冒号导致tar解压缩出错的问题。错误信息提示解析失败,原因是冒号被解析为地址。解决方法是在打包命令中使用`--force-local`参数来忽略冒号,确保正确解压缩。
32





