centos5.4裁剪笔记(3)-复制母版

本文介绍了一种缩减Linux系统镜像的方法,通过挂载、复制关键文件夹并裁剪不必要的组件来减小系统镜像的体积。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先把hdb mount起来

Mount /dev/hdb1 /mnt/hdb

df –k看,大小为576M

可以看到dev目录下是空的

 

先全部复制到2G盘上(免得以后再挂双硬盘)

Cd /root

Cp –cpR /mnt/hdb .

 

卸载hdb,留待以后可以进一步缩减

通过sftp把相关脚本先传上去cp_and_rm.sh

 

开始裁剪,首先运行cp_and_rm.sh

少了miscinitrd两个目录

得到的目标目录有156M之多

超过了原作者说的80M

 

接下来复制usr目录 cp_usr.sh,少了一些命令(最小版没有)

[root@locent5old ~]# ./cp_usr.sh

cp: cannot stat `/usr/share/nmap': No such file or directory

cp: cannot stat `/usr/bin/ftp-rfc': No such file or directory

cp: cannot stat `/usr/bin/nmap': No such file or directory

cp: cannot stat `/usr/sbin/traceroute': No such file or directory

cp: cannot stat `/usr/sbin/traceroute6': No such file or directory

cp: cannot stat `/usr/sbin/vsftpd': No such file or directory

cp: cannot stat `/usr/sbin/x86info': No such file or directory

cp: cannot stat `/usr/lib/libslang-utf8.so.*': No such file or directory

cp: cannot stat `/usr/lib/libwrap.so.*': No such file or directory

[root@locent5old ~]#

一共177M,虽然大了点(例如selinux,我感觉完全可以去掉)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值