Chinaunix首页 | 论坛 | 博客
  • 博客访问: 238024
  • 博文数量: 59
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 592
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-01 12:51
个人简介

你们都是我的客户,所以,我对你们是透明的

文章分类

全部博文(59)

文章存档

2016年(29)

2015年(30)

分类: LINUX

2015-09-29 09:43:17

装系统的时候swap给小了,2G内存给了2G swap,现在扩到4G,rhel6.4  lv。

新硬盘sdg,分区

[root@rac1 dev]# fdisk /dev/sdg

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0xaaba811a.

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 0×0000 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-261, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261):

Using default value 261

Command (m for help): p

Disk /dev/sdg: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 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: 0xaaba811a

   Device Boot      Start         End      Blocks   Id  System

/dev/sdg1               1         261     2096451   83  Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@rac2 dev]#

 

 

 创建pv

[root@rac1 dev]# pvcreate /dev/sdg1

  Physical volume "/dev/sdg1" successfully created

[root@rac1 dev]# pvs

  PV         VG      Fmt  Attr PSize  PFree

  /dev/sda2  vg_rac1 lvm2 a–  39.80g    0

  /dev/sdg1          lvm2 a–   2.00g 2.00g

[root@rac1 dev]# vgs

  VG      #PV #LV #SN Attr   VSize  VFree

  vg_rac1   1   3   0 wz–n- 39.80g    0

 

扩展vg

root@rac1 dev]# vgextend vg_rac1 /dev/sdg1

  Volume group "vg_rac1" successfully extended

[root@rac1 dev]# vgs

  VG      #PV #LV #SN Attr   VSize  VFree

  vg_rac1   2   3   0 wz–n- 41.80g 2.00g

[root@rac1 dev]# lvs

  LV       VG      Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync Convert

  LogVol00 vg_rac1 -wi-ao—  2.00g                                            

  LogVol01 vg_rac1 -wi-ao— 20.00g                                            

  LogVol02 vg_rac1 -wi-ao— 17.80g                   

 

 扩展lv

[root@rac1 dev]# lvresize /dev/vg_rac1/LogVol00 -L 3.99G

  Rounding size to boundary between physical extents: 3.99 GiB

  Extending logical volume LogVol00 to 3.99 GiB

  Logical volume LogVol00 successfully resized

[root@rac1 dev]# lvs

  LV       VG      Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync Convert

  LogVol00 vg_rac1 -wi-ao—  3.99g                                            

  LogVol01 vg_rac1 -wi-ao— 20.00g                                            

  LogVol02 vg_rac1 -wi-ao— 17.80g          

[root@rac1 mapper]# free -m

             total       used       free     shared    buffers     cached

Mem:          2006        274       1731          0         11        124

-/+ buffers/cache:        138       1868

Swap:         2047          0       2047

 

 关闭swap

[root@rac1 mapper]# swapoff /dev/vg_rac1/LogVol00

[root@rac1 mapper]# free -m

             total       used       free     shared    buffers     cached

Mem:          2006        272       1733          0         11        124

-/+ buffers/cache:        136       1869

Swap:            0          0          0

 

 建立交换分区

[root@rac1 mapper]# mkswap /dev/vg_rac1/LogVol00

mkswap: /dev/vg_rac1/LogVol00: warning: don't erase bootbits sectors

        on whole disk. Use -f to force.

Setting up swapspace version 1, size = 4186108 KiB

no label, UUID=98af06b9-daa4-49c1-8ebc-81e2007000ae

 

开启swap

[root@rac1 mapper]# swapon /dev/vg_rac1/LogVol00

[root@rac1 mapper]# free -m

             total       used       free     shared    buffers     cached

Mem:          2006        277       1729          0         12        125

-/+ buffers/cache:        139       1867

Swap:         4087          0       4087

over。

阅读(1524) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~