Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The server is off the shelf to clear the data.

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

A rented remote server in IDC is about to expire and is ready to go off the shelves and return the equipment. The data must be cleared before taking off the shelves to ensure the safety of the company's original data.

1. Backup data (backed up by rsync, ftp, etc., which will not be described in detail here)

2. Shut down the running service

3. Uninstall and format non-system partitions

4. Delete system partition configuration and files

The following is the process:

1. Log in to the server remotely through ssh to view the running service:

[root@fdcservers local] # chkconfig-- list | grep ": on" blk-availability0:off1:on2:off3:off4:off5:off6:offcpuspeed 0:off1:on2:off3:off4:off5:off6:offcrond 0:off1:off2:on3:on4:on5:on6:offhaldaemon 0:off1:off2:on3:on4:on5:on6:offip6tables 0:off1:off2:on3:on4:on5:on6:offiptables 0:off1:off2:on3:on4:on5:on6: Offlvm2-monitor 0:off1:on2:off3:off4:off5:off6:offmessagebus 0:off1:off2:on3:on4:on5:on6:offmysql 0:off1:off2:on3:on4:on5:on6:offnetwork 0:off1:off2:on3:on4:on5:on6:offnginx 0VO1VO1VO2VON3 VON3 VON4 VON5 VON6 VOLLAR offopeners * 0:off1:off2:on3:on4:on5:on6:offphp-fpm 0 : off1:off2:on3:on4:on5:on6:offsendmail 0:off1:off2:on3:on4:on5:on6:offsnmpd 0:off1:off2:on3:on4:on5:on6:offsshd 0:off1:off2:on3:on4:on5:on6:offudev-post 0:off1:on2:off3:off4:off5:off6:offvsftpd 0:off1:off2:on3:on4:on5:on6:offxinetd 0:off1:off2:off3:on4:on5:on6:off

As you can see, this server is a lnmp server, and services such as nginx mysql vsftpd php-fpm open*** are enabled. Of course, you can also use ps-aux to see the service running at that time.

2. Stop running related services

[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. Uninstall and format non-system partitions

View partition mounts

[root@fdcservers local] dfFilesystem 1K-blocks Used Available Use% Mounted on/dev/sda3 2879722992 931723820 1801710996 35% / tmpfs 8162448 0 8162448% / 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 288152536 1489356388 1248289655% / data4

As you can see, / data3 / data2 / data4 mounts several partitions / dev/sdb1 / dev/sdc1 / dev/sdd1 respectively. You can also check it with mount. In addition, there is a boot hard drive loading configuration in / etc/fstab.

Uninstall partitions with umount, or umount / dev/sdd1 / dev/sdb1 / dev/sdc1

[root@fdcservers local] umount / data4 [root@fdcservers local] umount / data3 [root@fdcservers local] # umount / data2umount: / data2: device is busy. (In some cases useful info about processes that use the device is found by lsof (8) or fuser (1))

There is a problem. The / data2 partition file is in use and cannot be uninstalled. Check the occupancy with lsof.

[root@fdcservers] # lsof-n | grep "data2" bash 28340 root cwd DIR 8 3 4096 260289 / data2nginx 6349 www 35r REG 8 33 280396246 79704097 / data2/www/test1.down.com/9000043.zipnginx 6349 www 38r REG 8 33 374411746 79704287 / data2/www/test1.down.com/9000993.zipnginx 6349 www 60r REG 8,33 320267112 79704297 / data2/www/test1.down.com/9001043.zipnginx 6350 www 35r REG 8,33 481860747 79704549 / data2/www/test1.down.com/9002333.zipnginx 6351 www 45r REG 8,33 566018961 79704460 / data2/www/test1.down.com/9001882.zipnginx 6352 www 23r REG 8,33 937357770 79704129 / data2/www/test1.down.com/9000203.zipnginx 6352 www 29r REG 8,33 1070330272 79704648 / data2/www/test1.down.com/9002852.zipnginx 6352 www 34r REG 8,33 320267112 79704297 / data2/www/test1.down.com/9001043.zipnginx 6352 www 51r REG 8,33 1028884960 79704408 / data2/www/test1.down .com / 9001612.zipnginx 6352 www 52r REG 8,33 1050340619 79704544 / data2/www/test1.down.com/9002312.zipnginx 6353 www 33r REG 8,33 1519968719 79704626 / data2/www/test1.down.com/9002742.zipnginx 6354 www 36r REG 8,33 1070330272 79704648 / data2/www/test1.down.com/9002852.zipnginx 6355 www 13r REG 8,33 1070330272 79704648 / data2/www/test1.down.com/9002852.zipnginx 6355 www 26r REG 8,33 871710375 79704674 / data2/www/test1.down.com/9009983.zipnginx 6355 www 30r REG 8,33 1070330272 79704648 / data2/www/test1.down.com/9002852.zipnginx 6355 www 48r REG 8,33 1494485593 79704669 / data2/www/test1.down.com/9009953.zipnginx 6356 www 28r REG 8,33 1070330272 79704648 / data2/www/test1.down.com/9002852.zipnginx 6356 www 31r REG 8,33 1323565056 79705782 / data2/www/test1.down.com/9100458.isonginx 6357 www 15r REG 8,33 1212593312 79704514 / data2/www/test1.down .com / 9002153.zipnginx 6357 www 36r REG 8,33 298144362 79704131 / data2/www/test1.down.com/9000213.zip

It turns out that there is a shell to enter the data2 directory, cd / exit will be normal. The other is that nginx is turned on again and ends with killall.

[root@fdcservers local] # killall nginx [root@fdcservers local] # umount / data2

Format unloaded partitions and clean up data (be careful, no regrets):

[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. Delete the system partition file (operation should be careful, there is no regret):

[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

Done.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report