
1、定期对重要文件系统扫描,并作对比,分析那些文件经常读写
#ls–lR/home>files.txt
#diff filesold.txt files.txt
通过分析预测空间的增长情况,同时可以考虑对不经常读写的文件进行压缩,以减少占用空间。
2、查看空间满的文件系统的inodes消耗
#df -i/home
如果还有大量inode可用,说明大文件占用空间,否则是可能大量小文件占用空间。
3、找出占用空间较大的目录
查看/home占用的空间
#du -hs/home
查看/home下占用空间超过1000m
#du |awk '$1>2000'
4、找出占用空间较大的文件
#find /homesize+2000k
5、找出最近修改或创建的文件
先touch一个你想要的时间的文件如下:
# touch-t 08190800 test
#find/home -newer test -print
6、删除系统日志等
删除生成core,mbox等文件
#find/ -name core|xargs rm -rf
删除日志
#rm -rf/var/log/*
7、对分区做链接
在有空间的分区,对没有空间分区做链接
#ln -s /home/usr/home
8、找出耗费大量的空间的进程
根据不同的应用,找出对应的进程,分析原因
9、检查并修复文件系统
#fsck -y/home
10、重启机器
Linux下清除磁盘分区及残留raid信息适用场景:
1、 查看硬盘编号
2、 删除磁盘分区
3、 删除磁盘内残留raid信息
*本文适用于430-8i等只有低速格式化或没有格式化功能的HBA卡使用,若raid卡有格式化功能,建议使用raid卡格式化解决问题。
一、查看硬盘编号
适用lsblk命令可以查看当先系统下的磁盘相关信息及磁盘大小
sda为硬盘为系统内的第一个硬盘
sda1为该硬盘下的第一个分区以此类推
二、删除磁盘分区
三、删除磁盘内残留raid信息
如果磁盘在其他raid卡中做过raid,在430-8i这类没有格式化功能的HBA卡中使用时,使用parted等相关命令无法将raid残留信息删除导致无法分区正常安装系统。
现象如下:
Raid卡残留信息的type为dmraid分区名称以`-ddf_开头
删除方法如下:
整体思路是通过dd命令将残留信息所在扇区置零
通常raid卡的信息会放在最后一个柱面即最后63个扇区
以sda为例:
发现有dpIBM等信息,为残留的raid信息
再打印发现已经置零,清除成功。
重启节点重新加载linux中才会生效
分区示例:比如分/dev/sda 硬盘#: fdisk /dev/sda
The number of cylinders for this disk is set to 19457.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): m #帮助,输入M
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition 删除一个分区
l list known partition types
m print this menu
n add a new partition 创建一个新的分区
o create a new empty DOS partition table
p print the partition table 打印分区表
q quit without saving changes 退出不保存
s create a new empty Sun disklabel
t change a partition\'s system id 改变分区类型
u change display/entry units 改变显示/输入的单位
v verify the partition table 验证这个分区表
w write table to disk and exit 保存退出
x extra functionality (experts only)
Command (m for help): d #删除分区
Partition number (1-8): 2
Command (m for help): p # 打印分区表
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0003ce53
Device Boot Start End Blocks Id System
/dev/sda1 * 13825307200007 HPFS/NTFS
/dev/sda37650 11474307200007 HPFS/NTFS
/dev/sda4 11475 1945764123447+ 5 Extended
/dev/sda5 11475 1444423856472+ 7 HPFS/NTFS
/dev/sda6 19247 19457 1694826 82 Linux swap / Solaris
/dev/sda7 14445 15660 9767488+ 83 Linux
/dev/sda8 15661 1924628804513+ 83 Linux
Partition table entries are not in disk order
Command (m for help): n #建立新分区
Command action
l logical (5 or over)
p primary partition (1-4)
p #主分区
Selected partition 2
First cylinder (3825-19457, default 3825): 可以选
Using default value 3825
Last cylinder, +cylinders or +size{K,M,G} (3825-7649, default 7649): 输入分区大小 比如100G
Using default value 7649
Command (m for help):
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)