您好,登錄后才能下訂單哦!
在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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。