中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

基于RHEL 6.5安裝Oracle 11g詳細教程(9)——附錄

發布時間:2020-06-23 02:55:40 來源:網絡 閱讀:1317 作者:kevin19851228 欄目:關系型數據庫

9  附錄

9.1  Linux LVM
9.1.1  LVM簡介

    LVM是 Logical Volume Manager(邏輯卷管理)的簡寫,它由Heinz Mauelshagen在Linux 2.4內核上實現。LVM將一個或多個硬盤的分區在邏輯上集合,相當于一個大硬盤來使用,當硬盤的空間不夠使用的時候,可以繼續將其它的硬盤的分區加入其中,這樣可以實現磁盤空間的動態管理,相對于普通的磁盤分區有很大的靈活性。

    與傳統的磁盤與分區相比,LVM為計算機提供了更高層次的磁盤存儲。它使系統管理員可以更方便的為應用與用戶分配存儲空間。在LVM管理下的存儲卷可以按需要隨時改變大小與移除(可能需對文件系統工具進行升級)。LVM也允許按用戶組對存儲卷進行管理,允許管理員用更直觀的名稱(如“sales”、“development” )代替物理磁盤名(如“sda”、“sdb”)來標識存儲卷。

如圖所示LVM模型:

基于RHEL 6.5安裝Oracle 11g詳細教程(9)——附錄

    由四個磁盤分區可以組成一個很大的空間,然后在這些空間上劃分一些邏輯分區,當一個邏輯分區的空間不夠用的時候,可以從剩余空間上劃分一些空間給空間不夠用的分區使用。

9.1.2  LVM基本術語

    前面談到,LVM是在磁盤分區和文件系統之間添加的一個邏輯層,來為文件系統屏蔽下層磁盤分區布局,提供一個抽象的盤卷,在盤卷上建立文件系統。首先我們討論以下幾個LVM術語:

    物理存儲介質(The physical media):這里指系統的存儲設備:硬盤,如:/dev/hda1、/dev/sda等等,是存儲系統最低層的存儲單元。

    物理卷(Physical Volume):物理卷就是指硬盤分區或從邏輯上與磁盤分區具有同樣功能的設備(如RAID),是LVM的基本存儲邏輯塊,但和基本的物理存儲介質(如分區、磁盤等)比較,卻包含有與LVM相關的管理參數。

    卷組(Volume Group):LVM卷組類似于非LVM系統中的物理硬盤,其由物理卷組成。可以在卷組上創建一個或多個“LVM分區”(邏輯卷),LVM卷組由一個或多個物理卷組成。

    邏輯卷(Logical Volume):LVM的邏輯卷類似于非LVM系統中的硬盤分區,在邏輯卷之上可以建立文件系統(比如/home或者/usr等)。

    PE(Physical Extent):每一個物理卷被劃分為稱為PE(Physical Extents)的基本單元,具有唯一編號的PE是可以被LVM尋址的最小單元。PE的大小是可配置的,默認為4MB。

    LE(Logical Extent):邏輯卷也被劃分為被稱為LE(Logical Extents) 的可被尋址的基本單位。在同一個卷組中,LE的大小和PE是相同的,并且一一對應。

簡單來說就是:

    PV:是物理的磁盤分區

    VG:LVM中的物理的磁盤分區,也就是PV,必須加入VG,可以將VG理解為一個倉庫或者是幾個大的硬盤。

    LV:也就是從VG中劃分的邏輯分區

如下圖所示PV、VG、LV三者關系:

基于RHEL 6.5安裝Oracle 11g詳細教程(9)——附錄

9.1.3 安裝LVM

首先確定系統中是否安裝了lvm工具:

[root@rhel65 ~]# rpm -qa | grep lvm

mesa-private-llvm-3.3-0.3.rc3.el6.x86_64

lvm2-libs-2.02.100-8.el6.x86_64

lvm2-2.02.100-8.el6.x86_64

如果命令結果輸入類似于上例,那么說明系統已經安裝了LVM管理工具;如果命令沒有輸出則說明沒有安裝LVM管理工具,則需要從網絡下載或者從光盤裝LVM rpm工具包。

9.1.4 創建和管理LVM

要創建一個LVM系統,一般需要經過以下步驟:

1、創建分區

使用分區工具(如:fdisk等)創建LVM分區,方法和創建其他一般分區的方式是一樣的,區別僅僅是LVM的分區類型為8e。

[root@rhel65 ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes

64 heads, 32 sectors/track, 20480 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000059fe

Device Boot Start End Blocks Id System

/dev/sda1 * 2 501 512000 83 Linux

/dev/sda2 502 20480 20458496 8e Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 18.8 GB, 18798870528 bytes

255 heads, 63 sectors/track, 2285 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

Disk /dev/mapper/VolGroup-lv_swap: 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: 0x00000000

Disk /dev/sdb: 53.7 GB, 53687091200 bytes

64 heads, 32 sectors/track, 51200 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

使用fdisk創建分區,根據設備文件的絕對路徑(/dev/hda)進入分區管理

[root@rhel65 ~]# 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 0x4849a8f8.

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): 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): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-51200, default 1):

Using default value 1

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

Command (m for help): t

Selected partition 1

Hex code (type L to list codes): L

0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris

1 FAT12 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-

2 XENIX root 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-

3 XENIX usr 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT-

4 FAT16 <32M 41 PPC PReP Boot 85 Linux extended c7 Syrinx

5 Extended 42 SFS 86 NTFS volume set da Non-FS data

6 FAT16 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / .

7 HPFS/NTFS 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility

8 AIX 4f QNX4.x 3rd part 8e Linux LVM df BootIt

9 AIX bootable 50 OnTrack DM 93 Amoeba e1 DOS access

a OS/2 Boot Manag 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O

b W95 FAT32 52 CP/M 9f BSD/OS e4 SpeedStor

c W95 FAT32 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs

e W95 FAT16 (LBA) 54 OnTrackDM6 a5 FreeBSD ee GPT

f W95 Ext'd (LBA) 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/

10 OPUS 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b

11 Hidden FAT12 5c Priam Edisk a8 Darwin UFS f1 SpeedStor

12 Compaq diagnost 61 SpeedStor a9 NetBSD f4 SpeedStor

14 Hidden FAT16 <3 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary

16 Hidden FAT16 64 Novell Netware af HFS / HFS+ fb VMware VMFS

17 Hidden HPFS/NTF 65 Novell Netware b7 BSDI fs fc VMware VMKCORE

18 AST SmartSleep 70 DiskSecure Mult b8 BSDI swap fd Linux raid auto

1b Hidden W95 FAT3 75 PC/IX bb Boot Wizard hid fe LANstep

1c Hidden W95 FAT3 80 Old Minix be Solaris boot ff BBT

1e Hidden W95 FAT1

Hex code (type L to list codes): 8e

Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 53.7 GB, 53687091200 bytes

64 heads, 32 sectors/track, 51200 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4849a8f8

Device Boot Start End Blocks Id System

/dev/sdb1 1 10241 10486768 8e Linux LVM

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@rhel65 ~]# partprobe

[root@rhel65 ~]# mkfs -t ext4 /dev/sdb1

mke2fs 1.41.12 (17-May-2010)

warning: 256 blocks unused.

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe blocks

656640 inodes, 2621440 blocks

131084 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2684354560

80 block groups

32768 blocks per group, 32768 fragments per group

8208 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

一定要指定分區的格式為8e,這是LVM的分區格式

2、創建PV

[root@rhel65 ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes

64 heads, 32 sectors/track, 20480 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000059fe

Device Boot Start End Blocks Id System

/dev/sda1 * 2 501 512000 83 Linux

/dev/sda2 502 20480 20458496 8e Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 18.8 GB, 18798870528 bytes

255 heads, 63 sectors/track, 2285 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

Disk /dev/mapper/VolGroup-lv_swap: 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: 0x00000000

Disk /dev/sdb: 53.7 GB, 53687091200 bytes

64 heads, 32 sectors/track, 51200 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4849a8f8

Device Boot Start End Blocks Id System

/dev/sdb1 1 10241 10486768 8e Linux LVM

[root@rhel65 ~]# pvdisplay

--- Physical volume ---

PV Name /dev/sda2

VG Name VolGroup

PV Size 19.51 GiB / not usable 3.00 MiB

Allocatable yes (but full)

PE Size 4.00 MiB

Total PE 4994

Free PE 0

Allocated PE 4994

PV UUID ISzl0X-XuA1-aG63-IdZH-HqKS-XuRm-DrzKM8

[root@rhel65 ~]# pvcreate /dev/sdb1

Physical volume "/dev/sdb1" successfully created

[root@rhel65 ~]# pvdisplay

--- Physical volume ---

PV Name /dev/sda2

VG Name VolGroup

PV Size 19.51 GiB / not usable 3.00 MiB

Allocatable yes (but full)

PE Size 4.00 MiB

Total PE 4994

Free PE 0

Allocated PE 4994

PV UUID ISzl0X-XuA1-aG63-IdZH-HqKS-XuRm-DrzKM8

"/dev/sdb1" is a new physical volume of "10.00 GiB"

--- NEW Physical volume ---

PV Name /dev/sdb1

VG Name

PV Size 10.00 GiB

Allocatable NO

PE Size 0

Total PE 0

Free PE 0

Allocated PE 0

PV UUID 67HlFe-THuW-GtNS-Hih2-chFP-3tP9-brczra

3、創建VG

[root@rhel65 ~]# vgdisplay

--- Volume group ---

VG Name VolGroup

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 3

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 2

Open LV 2

Max PV 0

Cur PV 1

Act PV 1

VG Size 19.51 GiB

PE Size 4.00 MiB

Total PE 4994

Alloc PE / Size 4994 / 19.51 GiB

Free PE / Size 0 / 0

VG UUID brWwTY-jesr-1lZw-lRfy-ZL7h-0nb4-3fRzgl

[root@rhel65 ~]# vgcreate VolGroup00 /dev/sdb1

Volume group "VolGroup00" successfully created

[root@rhel65 ~]# vgdisplay

--- Volume group ---

VG Name VolGroup00

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 1

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 0

Open LV 0

Max PV 0

Cur PV 1

Act PV 1

VG Size 10.00 GiB

PE Size 4.00 MiB

Total PE 2559

Alloc PE / Size 0 / 0

Free PE / Size 2559 / 10.00 GiB

VG UUID IA2LQx-Jljz-nGhg-VtHj-t52q-URmK-u9LV0Z

--- Volume group ---

VG Name VolGroup

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 3

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 2

Open LV 2

Max PV 0

Cur PV 1

Act PV 1

VG Size 19.51 GiB

PE Size 4.00 MiB

Total PE 4994

Alloc PE / Size 4994 / 19.51 GiB

Free PE / Size 0 / 0

VG UUID brWwTY-jesr-1lZw-lRfy-ZL7h-0nb4-3fRzgl

創建完成VG之后,才能從VG中劃分一個LV

4、創建LV

[root@rhel65 ~]# lvdisplay

--- Logical volume ---

LV Path /dev/VolGroup/lv_root

LV Name lv_root

VG Name VolGroup

LV UUID swKZLT-Cm7C-kkNH-AUGe-N9WY-q2bD-l9imoi

LV Write Access read/write

LV Creation host, time localhost.localdomain, 2014-05-12 03:14:21 +0800

LV Status available

# open 1

LV Size 17.51 GiB

Current LE 4482

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:0

--- Logical volume ---

LV Path /dev/VolGroup/lv_swap

LV Name lv_swap

VG Name VolGroup

LV UUID QGLb0h-Qtfe-yxzY-kLah-qnwX-FN7n-lIjxdW

LV Write Access read/write

LV Creation host, time localhost.localdomain, 2014-05-12 03:14:37 +0800

LV Status available

# open 1

LV Size 2.00 GiB

Current LE 512

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:1

[root@rhel65 ~]# lvcreate -L 5G -n lv_backup VolGroup00

Logical volume "lv_backup" created

[root@rhel65 ~]# lvdisplay

--- Logical volume ---

LV Path /dev/VolGroup00/lv_backup

LV Name lv_backup

VG Name VolGroup00

LV UUID hMOdIa-WZUL-ZGqQ-m5Jj-DrCf-KiPM-FNJRds

LV Write Access read/write

LV Creation host, time rhel65.kely.com, 2014-05-16 06:53:39 +0800

LV Status available

# open 0

LV Size 5.00 GiB

Current LE 1280

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:2

--- Logical volume ---

LV Path /dev/VolGroup/lv_root

LV Name lv_root

VG Name VolGroup

LV UUID swKZLT-Cm7C-kkNH-AUGe-N9WY-q2bD-l9imoi

LV Write Access read/write

LV Creation host, time localhost.localdomain, 2014-05-12 03:14:21 +0800

LV Status available

# open 1

LV Size 17.51 GiB

Current LE 4482

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:0

--- Logical volume ---

LV Path /dev/VolGroup/lv_swap

LV Name lv_swap

VG Name VolGroup

LV UUID QGLb0h-Qtfe-yxzY-kLah-qnwX-FN7n-lIjxdW

LV Write Access read/write

LV Creation host, time localhost.localdomain, 2014-05-12 03:14:37 +0800

LV Status available

# open 1

LV Size 2.00 GiB

Current LE 512

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:1

創建了一個名字為lv_backup,容量大小是5G的分區,其中:-L:指定LV的大小 -n:指定LV的名。VolGroup00:表示從這個VG中劃分LV

5、LV格式化及掛載

下一步需要對LV進行格式化(使用mksf進行格式化操作),然后LV才能存儲資料

[root@rhel65 ~]# mkfs -t ext4 /dev/VolGroup00/lv_backup

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 blocks

327680 inodes, 1310720 blocks

65536 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=1342177280

40 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

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

[root@rhel65 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root 18G 3.0G 14G 19% /

tmpfs 2.0G 72K 2.0G 1% /dev/shm

/dev/sda1 485M 39M 421M 9% /boot

[root@rhel65 ~]# mkdir /backup

[root@rhel65 ~]# mount /dev/VolGroup00/lv_backup /backup/

[root@rhel65 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root 18G 3.0G 14G 19% /

tmpfs 2.0G 72K 2.0G 1% /dev/shm

/dev/sda1 485M 39M 421M 9% /boot

/dev/mapper/VolGroup00-lv_backup 5.0G 138M 4.6G 3% /backup

將格式化后的LV分區掛載到指定的目錄下,就可以像普通目錄一樣存儲數據了

掛載之后,可以看到此LV的容量。

如果要在系統啟動的時候啟動LV,最好是將lv_backup寫入fstable 文件中,如下所示:

[root@rhel65 ~]# vi /etc/fstab

#

# /etc/fstab

# Created by anaconda on Mon May 12 03:15:06 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

#

/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1

UUID=374c9216-76f4-4e4b-a7a7-d7ecdd1d3740 /boot ext4 defaults 1 2

/dev/mapper/VolGroup-lv_swap 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/mapper/VolGroup00-lv_backup /backup ext4 defaults 0 0

使用Vim編輯器,打開/etc/fstab,在最后一行添加如上所示,其中/dev/VolGroup00/lv_backup指定需要掛載的分區LV,/root/test指定要掛載的目錄(掛載點),ext4分區文件系統格式,其它使用默認即可

9.1.5  LVM擴容

1、創建分區:

[root@rhel65 ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes

64 heads, 32 sectors/track, 20480 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000059fe

Device Boot Start End Blocks Id System

/dev/sda1 * 2 501 512000 83 Linux

/dev/sda2 502 20480 20458496 8e Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 18.8 GB, 18798870528 bytes

255 heads, 63 sectors/track, 2285 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

Disk /dev/mapper/VolGroup-lv_swap: 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: 0x00000000

Disk /dev/sdb: 53.7 GB, 53687091200 bytes

64 heads, 32 sectors/track, 51200 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4849a8f8

Device Boot Start End Blocks Id System

/dev/sdb1 1 10241 10486768 8e Linux LVM

Disk /dev/mapper/VolGroup00-lv_backup: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 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@rhel65 ~]# fdisk /dev/sdb

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): 2

First cylinder (10242-51200, default 10242):

Using default value 10242

Last cylinder, +cylinders or +size{K,M,G} (10242-51200, default 51200): +10G

Command (m for help): t

Partition number (1-4): 2

Hex code (type L to list codes): 8e

Changed system type of partition 2 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 53.7 GB, 53687091200 bytes

64 heads, 32 sectors/track, 51200 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4849a8f8

Device Boot Start End Blocks Id System

/dev/sdb1 1 10241 10486768 8e Linux LVM

/dev/sdb2 10242 20482 10486784 8e Linux LVM

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@rhel65 ~]# partprobe

[root@rhel65 ~]# mkfs -t ext4 /dev/sdb2

mke2fs 1.41.12 (17-May-2010)

warning: 256 blocks unused.

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe blocks

656640 inodes, 2621440 blocks

131084 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2684354560

80 block groups

32768 blocks per group, 32768 fragments per group

8208 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 23 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

[root@rhel65 ~]# partx /dev/sdb

# 1: 32- 20973567 ( 20973536 sectors, 10738 MB)

# 2: 20973568- 41947135 ( 20973568 sectors, 10738 MB)

# 3: 0- -1 ( 0 sectors, 0 MB)

# 4: 0- -1 ( 0 sectors, 0 MB)

2、創建PV

[root@rhel65 ~]# pvdisplay

--- Physical volume ---

PV Name /dev/sdb1

VG Name VolGroup00

PV Size 10.00 GiB / not usable 4.98 MiB

Allocatable yes

PE Size 4.00 MiB

Total PE 2559

Free PE 1279

Allocated PE 1280

PV UUID 67HlFe-THuW-GtNS-Hih2-chFP-3tP9-brczra

--- Physical volume ---

PV Name /dev/sda2

VG Name VolGroup

PV Size 19.51 GiB / not usable 3.00 MiB

Allocatable yes (but full)

PE Size 4.00 MiB

Total PE 4994

Free PE 0

Allocated PE 4994

PV UUID ISzl0X-XuA1-aG63-IdZH-HqKS-XuRm-DrzKM8

[root@rhel65 ~]# pvcreate /dev/sdb2

Physical volume "/dev/sdb2" successfully created

[root@rhel65 ~]# pvdisplay

--- Physical volume ---

PV Name /dev/sdb1

VG Name VolGroup00

PV Size 10.00 GiB / not usable 4.98 MiB

Allocatable yes

PE Size 4.00 MiB

Total PE 2559

Free PE 1279

Allocated PE 1280

PV UUID 67HlFe-THuW-GtNS-Hih2-chFP-3tP9-brczra

--- Physical volume ---

PV Name /dev/sda2

VG Name VolGroup

PV Size 19.51 GiB / not usable 3.00 MiB

Allocatable yes (but full)

PE Size 4.00 MiB

Total PE 4994

Free PE 0

Allocated PE 4994

PV UUID ISzl0X-XuA1-aG63-IdZH-HqKS-XuRm-DrzKM8

"/dev/sdb2" is a new physical volume of "10.00 GiB"

--- NEW Physical volume ---

PV Name /dev/sdb2

VG Name

PV Size 10.00 GiB

Allocatable NO

PE Size 0

Total PE 0

Free PE 0

Allocated PE 0

PV UUID 4negrT-RwR2-AQoZ-33GH-9JzD-Qftw-eCbmll

3、擴展VG

將/dev/sdb2添加到VolGroup00中。

[root@rhel65 ~]# vgdisplay

--- Volume group ---

VG Name VolGroup00

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 2

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 1

Open LV 1

Max PV 0

Cur PV 1

Act PV 1

VG Size 10.00 GiB

PE Size 4.00 MiB

Total PE 2559

Alloc PE / Size 1280 / 5.00 GiB

Free PE / Size 1279 / 5.00 GiB

VG UUID IA2LQx-Jljz-nGhg-VtHj-t52q-URmK-u9LV0Z

--- Volume group ---

VG Name VolGroup

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 3

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 2

Open LV 2

Max PV 0

Cur PV 1

Act PV 1

VG Size 19.51 GiB

PE Size 4.00 MiB

Total PE 4994

Alloc PE / Size 4994 / 19.51 GiB

Free PE / Size 0 / 0

VG UUID brWwTY-jesr-1lZw-lRfy-ZL7h-0nb4-3fRzgl

[root@rhel65 ~]# vgextend VolGroup00 /dev/sdb2

Volume group "VolGroup00" successfully extended

[root@rhel65 ~]# vgdisplay

--- Volume group ---

VG Name VolGroup00

System ID

Format lvm2

Metadata Areas 2

Metadata Sequence No 3

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 1

Open LV 1

Max PV 0

Cur PV 2

Act PV 2

VG Size 20.00 GiB

PE Size 4.00 MiB

Total PE 5119

Alloc PE / Size 1280 / 5.00 GiB

Free PE / Size 3839 / 15.00 GiB

VG UUID IA2LQx-Jljz-nGhg-VtHj-t52q-URmK-u9LV0Z

--- Volume group ---

VG Name VolGroup

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 3

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 2

Open LV 2

Max PV 0

Cur PV 1

Act PV 1

VG Size 19.51 GiB

PE Size 4.00 MiB

Total PE 4994

Alloc PE / Size 4994 / 19.51 GiB

Free PE / Size 0 / 0

VG UUID brWwTY-jesr-1lZw-lRfy-ZL7h-0nb4-3fRzgl

4、擴展LV

給lv_backup增加1G空間,擴展到6G

[root@rhel65 ~]# lvdisplay

--- Logical volume ---

LV Path /dev/VolGroup00/lv_backup

LV Name lv_backup

VG Name VolGroup00

LV UUID hMOdIa-WZUL-ZGqQ-m5Jj-DrCf-KiPM-FNJRds

LV Write Access read/write

LV Creation host, time rhel65.kely.com, 2014-05-16 06:53:39 +0800

LV Status available

# open 1

LV Size 5.00 GiB

Current LE 1280

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:2

--- Logical volume ---

LV Path /dev/VolGroup/lv_root

LV Name lv_root

VG Name VolGroup

LV UUID swKZLT-Cm7C-kkNH-AUGe-N9WY-q2bD-l9imoi

LV Write Access read/write

LV Creation host, time localhost.localdomain, 2014-05-12 03:14:21 +0800

LV Status available

# open 1

LV Size 17.51 GiB

Current LE 4482

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:0

--- Logical volume ---

LV Path /dev/VolGroup/lv_swap

LV Name lv_swap

VG Name VolGroup

LV UUID QGLb0h-Qtfe-yxzY-kLah-qnwX-FN7n-lIjxdW

LV Write Access read/write

LV Creation host, time localhost.localdomain, 2014-05-12 03:14:37 +0800

LV Status available

# open 1

LV Size 2.00 GiB

Current LE 512

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:1

[root@rhel65 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root 18G 3.0G 14G 19% /

tmpfs 2.0G 72K 2.0G 1% /dev/shm

/dev/sda1 485M 39M 421M 9% /boot

/dev/mapper/VolGroup00-lv_backup 5.0G 138M 4.6G 3% /backup

[root@rhel65 ~]# lvextend -L +1G /dev/VolGroup00/lv_backup

Extending logical volume lv_backup to 6.00 GiB

Logical volume lv_backup successfully resized

[root@rhel65 ~]# resize2fs /dev/VolGroup00/lv_backup

resize2fs 1.41.12 (17-May-2010)

Filesystem at /dev/VolGroup00/lv_backup is mounted on /backup; on-line resizing required

old desc_blocks = 1, new_desc_blocks = 1

Performing an on-line resize of /dev/VolGroup00/lv_backup to 1572864 (4k) blocks.

The filesystem on /dev/VolGroup00/lv_backup is now 1572864 blocks long.

[root@rhel65 ~]# lvdisplay

--- Logical volume ---

LV Path /dev/VolGroup00/lv_backup

LV Name lv_backup

VG Name VolGroup00

LV UUID hMOdIa-WZUL-ZGqQ-m5Jj-DrCf-KiPM-FNJRds

LV Write Access read/write

LV Creation host, time rhel65.kely.com, 2014-05-16 06:53:39 +0800

LV Status available

# open 1

LV Size 6.00 GiB

Current LE 1536

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:2

--- Logical volume ---

LV Path /dev/VolGroup/lv_root

LV Name lv_root

VG Name VolGroup

LV UUID swKZLT-Cm7C-kkNH-AUGe-N9WY-q2bD-l9imoi

LV Write Access read/write

LV Creation host, time localhost.localdomain, 2014-05-12 03:14:21 +0800

LV Status available

# open 1

LV Size 17.51 GiB

Current LE 4482

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:0

--- Logical volume ---

LV Path /dev/VolGroup/lv_swap

LV Name lv_swap

VG Name VolGroup

LV UUID QGLb0h-Qtfe-yxzY-kLah-qnwX-FN7n-lIjxdW

LV Write Access read/write

LV Creation host, time localhost.localdomain, 2014-05-12 03:14:37 +0800

LV Status available

# open 1

LV Size 2.00 GiB

Current LE 512

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:1

[root@rhel65 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root 18G 3.0G 14G 19% /

tmpfs 2.0G 72K 2.0G 1% /dev/shm

/dev/sda1 485M 39M 421M 9% /boot

/dev/mapper/VolGroup00-lv_backup 6.0G 138M 5.5G 3% /backup

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

柏乡县| 桃源县| 曲靖市| 隆子县| 武功县| 普兰县| 罗山县| 孟州市| 镶黄旗| 拉孜县| 嘉定区| 杨浦区| 平果县| 清水河县| 扶风县| 芮城县| 蒲城县| 大化| 南康市| 雷波县| 临潭县| 长治市| 永修县| 石渠县| 纳雍县| 乌恰县| 丰原市| 曲麻莱县| 石河子市| 砚山县| 无为县| 涟水县| 手游| 萨嘎县| 定远县| 治多县| 蕲春县| 马鞍山市| 互助| 加查县| 海门市|