参考:
去压缩:
但是发现好像文件很大,不对劲啊
所以去参考:
查看文件大小:
[root@eml-131 www.crifan.com]# du -h –max-depth=1 . 7.8M ./wp-admin 74M ./wp-myadmin 98M ./wiki 15M ./uploads 4.0K ./.well-known 16M ./wp-includes 4.0K ./sql 4.7G ./backup 16K ./d3 3.9G ./files 16K ./released 4.0K ./cgi-bin 2.9M ./chenmo 1.4G ./wp-content 11G . |
然后看到backup文件夹下,果然只是备份文件:
[root@eml-131 backup]# du -h –max-depth=1 . 7.6M ./wp-admin 98M ./wiki 15M ./uploads 15M ./wp-includes 285M ./sql 16K ./d3 3.5G ./files 16K ./released 4.0K ./cgi-bin 2.9M ./chenmo 877M ./wp-content 4.7G . |
所以去删除掉backup
再去查看空间大小,才是对的:
[root@eml-131 www.crifan.com]# du -h –max-depth=1 . 7.8M ./wp-admin 74M ./wp-myadmin 98M ./wiki 15M ./uploads 4.0K ./.well-known 16M ./wp-includes 4.0K ./sql 16K ./d3 3.9G ./files 16K ./released 4.0K ./cgi-bin 2.9M ./chenmo 1.4G ./wp-content 5.5G . |
共5.5G
然后再去压缩:
tar -cjvf crifan_com_files_20170828.tar.bz2 www.crifan.com/ |
最终压缩得到4G多的文件:
[root@eml-131 wwwroot]# pwd /home/wwwroot [root@eml-131 wwwroot]# ll -lha total 4.2G drwxr-xr-x. 5 www root 4.0K Aug 28 21:21 . drwxr-xr-x. 5 root root 4.0K Jun 13 07:03 .. -rw-r–r– 1 root root 4.2G Aug 28 22:04 crifan_com_files_20170828.tar.bz2 drwxr-xr-x. 3 www www 4.0K Jun 13 07:03 default2 drwxr-xr-x. 16 www www 4.0K Jun 14 06:42 demo.crifan.com drwxr-xr-x 15 www www 4.0K Aug 28 21:20 www.crifan.com |
然后再去备份数据库:
lnmp 备份sql
LNMP备份数据库 – wshedu的专栏 – CSDN博客
参考:
语法是:
mysqldump -u [username] -p[password] -h [host] [databaseName] > [backup-name].sql |
然后去执行:
mysqldump -uroot -pxxx crifan.com > /home/wwwroot/www.crifan.com/crifan_com_db_wp.sql |
提示:
[root@eml-131 www.crifan.com]# mysqldump -uroot -pxxx crifan.com > /home/wwwroot/www.crifan.com/crifan_com_db_wp.sql mysqldump: [Warning] Using a password on the command line interface can be insecure. [root@eml-131 www.crifan.com]# ll -h *.sql -rw-r–r– 1 root root 142M Aug 29 03:54 crifan_com_db_wp.sql |
然后就备份好了。
然后放在网站根目录后,就可以去下载工具(比如迅雷)去下来了。