linux修改swap lv大小,linux lv 扩swap

装系统的时候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

eextended

pprimary 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 BootStartEndBlocksIdSystem

/dev/sdg11261209645183Linux

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

PVVGFmtAttr PSizePFree

/dev/sda2vg_rac1 lvm2 a–39.80g0

/dev/sdg1lvm2 a–2.00g 2.00g

[root@rac1 dev]# vgs

VG#PV #LV #SN AttrVSizeVFree

vg_rac1130 wz–n- 39.80g0

扩展vg

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

Volume group "vg_rac1" successfully extended

[root@rac1 dev]# vgs

VG#PV #LV #SN AttrVSizeVFree

vg_rac1230 wz–n- 41.80g 2.00g

[root@rac1 dev]# lvs

LVVGAttrLSizePool 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

LVVGAttrLSizePool 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

totalusedfreesharedbufferscached

Mem:20062741731011124

-/+ buffers/cache:1381868

Swap:204702047

关闭swap

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

[root@rac1 mapper]# free -m

totalusedfreesharedbufferscached

Mem:20062721733011124

-/+ buffers/cache:1361869

Swap:000

建立交换分区

[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

totalusedfreesharedbufferscached

Mem:20062771729012125

-/+ buffers/cache:1391867

Swap:408704087

over。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值