free 查看监控系统的内存的使用情况
[root@localhost ~]# free –h
free: invalid option — –
usage: free [-b|-k|-m|-g] [-l] [-o] [-t] [-s delay] [-c count] [-V]
-b,-k,-m,-g show output in bytes, KB, MB, or GB
-l show detailed low and high memory statistics
-o use old format (no -/+buffers/cache line)
-t display total for RAM + swap
-s update every [delay] seconds
-c update [count] times
-V display version information and exit
[root@localhost ~]# free
total used free shared buffers cached
Mem: 89032 86476 2556 0 992 32048
-/+ buffers/cache: 53436 35596
Swap: 1081336 49636 1031700
//可以查看到swap
—————
top 可以查看存储设备内存使用的情况
[root@localhost ~]# top –h
top: procps version 3.2.7
usage: top -hv | -bcisSHM -d delay -n iterations [-u user | -U user] -p pid [,pid …]
[root@localhost ~]# top
top – 18:52:54 up 17 min, 3 users, load average: 2.03, 1.73, 0.82
Tasks: 113 total, 1 running, 112 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 89032k total, 86616k used, 2416k free, 984k buffers
Swap: 1081336k total, 49636k used, 1031700k free, 32048k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 15 0 2064 536 512 S 0.0 0.6 0:09.71 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/
—————-
fdisk -l(82是虚拟内存)
[root@localhost ~]# fdisk -l
Disk /dev/sda: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 10443 83778975 8e Linux LVM
—————-
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
77G 2.5G 70G 4% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 44M 0 44M 0% /dev/shm
/dev/hdc 2.9G 2.9G 0 100% /media/RHEL_5.3 i386 DVD
[root@localhost ~]#
—————-
1.新增磁盘添加swap分区
[root@localhost ~]# fdisk /dev/sda
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)
更改swap分区需要:
1)n–>p–>3 添加分区
2)t–>l–>82 改变分区的id
Command (m for help): w
[root@localhost ~]# partprobe /dev/sda
#mdswap /dev/sda3
//添加到文件系统表里,系统重启时会自动加载swap分区(swap分区是没有挂载点的)
#vim /etc/fstab
/dev/sda3 swap swap defaults 0 0
[root@localhost ~]# vim /etc/inittab
//定义个级别和终端的控制文件
2.文件增加虚拟分区
[root@localhost ~]# dd if=/dev/zero of=/swapfile bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 1.23829 seconds, 84.7 MB/s
[root@localhost ~]# mkswap /swapfile
Setting up swapspace version 1, size = 104853 kB
[root@localhost ~]# free
total used free shared buffers cached
Mem: 89032 86796 2236 0 516 36628
-/+ buffers/cache: 49652 39380
Swap: 1081336 51356 1029980
[root@localhost ~]# swapon /swapfile
[root@localhost ~]# free
total used free shared buffers cached
Mem: 89032 86924 2108 0 576 36580
-/+ buffers/cache: 49768 39264
Swap: 1183728 51356 1132372
[root@localhost ~]# swapoff /swapfile //取消swap分区文件
[root@localhost ~]# free -m
total used free shared buffers cached
Mem: 86 84 2 0 0 35
-/+ buffers/cache: 48 38
Swap: 1055 50 1005
[root@localhost ~]# vim /etc/fstab
/swapfile swap swap defaults 0 0
[root@localhost ~]# swapon -s
//查看哪些文件是被虚拟分区使用的
————–
更改卷标
[root@localhost ~]# e2label /dev/sda1
/boot
[root@localhost ~]# e2label /dev/sda1 boot1
[root@localhost ~]# mount LABEL=BOO
#umount /dev/sda2
#mkfs.ext2 -m 1 /dev/sda2
//格式化保留1%
#tune2fs /dev/sda2 //查看详细信息
#dumpe2fs /dev/sda2 //查看更详细
startx 进入图形模式时不进行身份验证;init 5 切换到图形时要身份验证
u盘挂载是按udev设备自动识别的