您好,登录后才能下订单哦!
在IDC的租用的一台远程服务器要到期了准备下架了,归还设备了。下架前必须清除数据,保障公司原数据安全不外泄。
1、备份数据(通过rsync、ftp等方式备份,在此就不详细介绍了)
2、关闭运行服务
3、卸载并格式化非系统分区
4、删除系统分区配置及文件
以下是过程:
1、通过ssh远程登录服务器,查看运行服务:
[root@fdcservers local]# chkconfig --list|grep ":on" blk-availability0:off1:on2:off3:off4:off5:off6:off cpuspeed 0:off1:on2:off3:off4:off5:off6:off crond 0:off1:off2:on3:on4:on5:on6:off haldaemon 0:off1:off2:on3:on4:on5:on6:off ip6tables 0:off1:off2:on3:on4:on5:on6:off iptables 0:off1:off2:on3:on4:on5:on6:off lvm2-monitor 0:off1:on2:off3:off4:off5:off6:off messagebus 0:off1:off2:on3:on4:on5:on6:off mysql 0:off1:off2:on3:on4:on5:on6:off network 0:off1:off2:on3:on4:on5:on6:off nginx 0:off1:off2:on3:on4:on5:on6:off open*** 0:off1:off2:on3:on4:on5:on6:off php-fpm 0:off1:off2:on3:on4:on5:on6:off sendmail 0:off1:off2:on3:on4:on5:on6:off snmpd 0:off1:off2:on3:on4:on5:on6:off sshd 0:off1:off2:on3:on4:on5:on6:off udev-post 0:off1:on2:off3:off4:off5:off6:off vsftpd 0:off1:off2:on3:on4:on5:on6:off xinetd 0:off1:off2:off3:on4:on5:on6:off
可以看到,本台服务器是lnmp服务器,开启了nginx mysql vsftpd php-fpm open*** 等服务。当然,也可以用ps -aux来查看当时运行服务。
2、停止相关运行服务
[root@fdcservers local]# service nginx stop [root@fdcservers local]# service crond stop [root@fdcservers local]# service php-fpm stop [root@fdcservers local]# service mysqld stop [root@fdcservers local]# service vsftp stop [root@fdcservers local]# service xinetd stop
3、卸载并格式化非系统分区
查看分区挂载情况
[root@fdcservers local]df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 2879722992 931723820 1801710996 35% / tmpfs 8162448 0 8162448 0% /dev/shm /dev/sda1 289293 38827 235106 15% /boot /dev/sdc1 2884152536 1133708020 1603931264 42% /data2 /dev/sdb1 2884152536 1513359216 1224280068 56% /data3 /dev/sdd1 2884152536 1489356388 1248282896 55% /data4
可以看到,/data3 /data2 /data4 分别挂载了/dev/sdb1 /dev/sdc1 /dev/sdd1 几个分区。也可以用mount查看,另外/etc/fstab里面有启动硬盘加载配置。
用umount卸载分区,也可以umount /dev/sdd1 /dev/sdb1 /dev/sdc1
[root@fdcservers local]umount /data4 [root@fdcservers local]umount /data3 [root@fdcservers local]# umount /data2 umount: /data2: device is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))
有问题,/data2 分区文件在使用中,无法卸载,用lsof查看一下占用。
[root@fdcservers ~]# lsof -n |grep "data2" bash 28340 root cwd DIR 8,3 4096 260289 /data2 nginx 6349 www 35r REG 8,33 280396246 79704097 /data2/www/test1.down.com/9000043.zip nginx 6349 www 38r REG 8,33 374411746 79704287 /data2/www/test1.down.com/9000993.zip nginx 6349 www 60r REG 8,33 320267112 79704297 /data2/www/test1.down.com/9001043.zip nginx 6350 www 35r REG 8,33 481860747 79704549 /data2/www/test1.down.com/9002333.zip nginx 6351 www 45r REG 8,33 566018961 79704460 /data2/www/test1.down.com/9001882.zip nginx 6352 www 23r REG 8,33 937357770 79704129 /data2/www/test1.down.com/9000203.zip nginx 6352 www 29r REG 8,33 1070330272 79704648 /data2/www/test1.down.com/9002852.zip nginx 6352 www 34r REG 8,33 320267112 79704297 /data2/www/test1.down.com/9001043.zip nginx 6352 www 51r REG 8,33 1028884960 79704408 /data2/www/test1.down.com/9001612.zip nginx 6352 www 52r REG 8,33 1050340619 79704544 /data2/www/test1.down.com/9002312.zip nginx 6353 www 33r REG 8,33 1519968719 79704626 /data2/www/test1.down.com/9002742.zip nginx 6354 www 36r REG 8,33 1070330272 79704648 /data2/www/test1.down.com/9002852.zip nginx 6355 www 13r REG 8,33 1070330272 79704648 /data2/www/test1.down.com/9002852.zip nginx 6355 www 26r REG 8,33 871710375 79704674 /data2/www/test1.down.com/9009983.zip nginx 6355 www 30r REG 8,33 1070330272 79704648 /data2/www/test1.down.com/9002852.zip nginx 6355 www 48r REG 8,33 1494485593 79704669 /data2/www/test1.down.com/9009953.zip nginx 6356 www 28r REG 8,33 1070330272 79704648 /data2/www/test1.down.com/9002852.zip nginx 6356 www 31r REG 8,33 1323565056 79705782 /data2/www/test1.down.com/9100458.iso nginx 6357 www 15r REG 8,33 1212593312 79704514 /data2/www/test1.down.com/9002153.zip nginx 6357 www 36r REG 8,33 298144362 79704131 /data2/www/test1.down.com/9000213.zip
原来是有个shell进入了data2这个目录,cd /退出后就正常了。还有一个是nginx又开了,用killall结束。
[root@fdcservers local]# killall nginx [root@fdcservers local]# umount /data2
格式化已卸载分区,清理数据(操作须谨慎,没有后悔药的):
[root@fdcservers local]mkfs -t ext4 /dev/sdb1 [root@fdcservers local]mkfs -t ext4 /dev/sdc1 [root@fdcservers local]mkfs -t ext4 /dev/sdd1
4、删除系统分区文件(操作须谨慎,没有后悔药的):
[root@fdcservers local]rm -rf /data/* [root@fdcservers local]rm -rf /etc/snmp [root@fdcservers local]rm -rf /etc/vsftpd [root@fdcservers local]rm -rf /usr/local
完成。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。