在IDC的租用的一臺遠程服務(wù)器要到期了準(zhǔn)備下架了,歸還設(shè)備了。下架前必須清除數(shù)據(jù),保障公司原數(shù)據(jù)安全不外泄。
10年的銅陵網(wǎng)站建設(shè)經(jīng)驗,針對設(shè)計、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時及時工作處理。全網(wǎng)整合營銷推廣的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整銅陵建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計,從而大程度地提升瀏覽體驗。創(chuàng)新互聯(lián)公司從事“銅陵網(wǎng)站設(shè)計”,“銅陵網(wǎng)站推廣”以來,每個客戶項目都認真落實執(zhí)行。
1、備份數(shù)據(jù)(通過rsync、ftp等方式備份,在此就不詳細介紹了)
2、關(guān)閉運行服務(wù)
3、卸載并格式化非系統(tǒng)分區(qū)
4、刪除系統(tǒng)分區(qū)配置及文件
以下是過程:
1、通過ssh遠程登錄服務(wù)器,查看運行服務(wù):
[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
可以看到,本臺服務(wù)器是lnmp服務(wù)器,開啟了nginx mysql vsftpd php-fpm open*** 等服務(wù)。當(dāng)然,也可以用ps -aux來查看當(dāng)時運行服務(wù)。
2、停止相關(guān)運行服務(wù)
[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、卸載并格式化非系統(tǒng)分區(qū)
查看分區(qū)掛載情況
[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 幾個分區(qū)。也可以用mount查看,另外/etc/fstab里面有啟動硬盤加載配置。
用umount卸載分區(qū),也可以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 分區(qū)文件在使用中,無法卸載,用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結(jié)束。
[root@fdcservers local]# killall nginx [root@fdcservers local]# umount /data2
格式化已卸載分區(qū),清理數(shù)據(jù)(操作須謹(jǐn)慎,沒有后悔藥的):
[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、刪除系統(tǒng)分區(qū)文件(操作須謹(jǐn)慎,沒有后悔藥的):
[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
完成。