通过挂载磁盘解决SWAP分区和磁盘空间不足

曾经给客户搭建oracle RAC,操作系统是rhel-server-6.4-x86_64,oracle版本是11.2.0.4,由于操作系统不是自己装的,所以在搭建RAC之前先检查一下操作系统的配置是否符合搭建RAC环境。检查发现操作系统的Swap分了2G,物理内存32G,并且将本地硬盘划分为2个盘,/目录30多G(小),共120G,不符合搭建RAC的要求,下面对其修改:

[root@rac02 ~]# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e6be0
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64         325     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             325        5222    39332864   83  Linux
 
Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
 
[root@rac02 /]# free -m
             total       used       free     shared    buffers     cached
Mem:         32109        697      31411          0         35        385
-/+ buffers/cache:        277      31832
Swap:         2047          0       2047

解决方法:需要把sdb分为两个区,一个挂载到/u01下面,一个加到Swap下,挂载到/u01下的需要格式化。

[root@rac02 opt]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xfc7e6905.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
 
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-10443, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-10443, default 10443): +17000M          
 
Command (m for help): n   
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (2169-10443, default 2169):
Using default value 2169
Last cylinder, +cylinders or +size{K,M,G} (2169-10443, default 10443):
Using default value 10443
 
Command (m for help): p
 
Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xfc7e6905
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2168    17414428+  83  Linux
/dev/sdb2            2169       10443    66468937+  83  Linux
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
[root@rac02 opt]# mkfs.ext4 /dev/sdb2
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
4161536 inodes, 16617234 blocks
830861 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
508 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424
 
Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@rac02 opt]# mkswap /dev/sdb1
Setting up swapspace version 1, size = 17414424 KiB
no label, UUID=76984b09-ffa5-4c4b-a9f0-e3c614ff2cda
[root@rac02 u01]# vi /etc/fstab
 
#
# /etc/fstab
# Created by anaconda on Sun Jun 22 04:28:39 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=90c0f9e8-64fe-4b58-b2a4-62c64cafa2d3 /                       ext4    defaults        1 1
UUID=581ea08e-b25c-4ac6-a180-1e768813a87c /boot                   ext4    defaults        1 2
UUID=33d295c5-fa00-4536-b2a5-3685ad698daa swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

/dev/sdb2               /u01                    ext4    defaults        0 0
/dev/sdb1               swap                    swap    defaults        0 0
[root@rac02 u01]# mount -a
[root@rac02 u01]# ls /u01
lost+found
[root@rac02 11.2.0]# free -m
             total       used       free     shared    buffers     cached
Mem:         32109        711      31398          0         35        385
-/+ buffers/cache:        289      31820
Swap:        19054          0      19054


如果Swap没有改变

[root@rac02 11.2.0]# swapon -va
swapon on /dev/sdb1
swapon: /dev/sdb1: found swap signature: version 1, page-size 4, same byte order
swapon: /dev/sdb1: pagesize=4096, swapsize=17832374272, devsize=17832374784

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值