Linux卷管理

[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 19G 11G 6.5G 63% /
tmpfs 995M 239M 756M 24% /dev/shm
/dev/sda1 194M 46M 139M 25% /boot
/dev/sda4 20G 1.4G 18G 7% /rman
/dev/sdb1 30G 863M 28G 4% /arch1
[[email protected] ~]# 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: 0x00079a2c

Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 217 1536000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 217 2611 19229696 83 Linux
/dev/sda4 2611 5221 20966162+ 83 Linux

Disk /dev/sdb: 32.2 GB, 32212254720 bytes
64 heads, 51 sectors/track, 19275 cylinders
Units = cylinders of 3264 * 512 = 1671168 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4867b2f5

Device Boot Start End Blocks Id System
/dev/sdb1 1 19276 31456256 83 Linux

Disk /dev/sdc: 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

Disk /dev/sdc doesn‘t contain a valid partition table

Disk /dev/sdd: 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

Disk /dev/sdd doesn‘t contain a valid partition table

Disk /dev/sde: 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

Disk /dev/sde doesn‘t contain a valid partition table

Disk /dev/sdf: 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

Disk /dev/sdf doesn‘t contain a valid partition table
[[email protected] ~]# ll /dev/sd*
brw-rw----. 1 root disk 8, 0 May 25 09:13 /dev/sda
brw-rw----. 1 root disk 8, 1 May 25 09:13 /dev/sda1
brw-rw----. 1 root disk 8, 2 May 25 09:13 /dev/sda2
brw-rw----. 1 root disk 8, 3 May 25 09:13 /dev/sda3
brw-rw----. 1 root disk 8, 4 May 25 09:13 /dev/sda4
brw-rw----. 1 root disk 8, 16 May 25 09:13 /dev/sdb
brw-rw----. 1 root disk 8, 17 May 25 09:13 /dev/sdb1
brw-rw----. 1 root disk 8, 32 May 25 09:13 /dev/sdc
brw-rw----. 1 root disk 8, 48 May 25 09:13 /dev/sdd
brw-rw----. 1 root disk 8, 64 May 25 09:13 /dev/sde
brw-rw----. 1 root disk 8, 80 May 25 09:13 /dev/sdf
[[email protected] ~]# ]pvcreate /dev/sdc
-bash: ]pvcreate: command not found

[[email protected] mnt]# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only
[[email protected] mnt]# cd /mnt/
[[email protected] mnt]# ll
total 806
drwxr-xr-x. 3 root root 2048 May 27 2011 EFI
-rw-r--r--. 1 root root 7041 May 27 2011 EULA
-rw-r--r--. 1 root root 7041 May 27 2011 eula.en_US
-rw-r--r--. 1 root root 3334 May 27 2011 eula.py
-rw-r--r--. 1 root root 18390 May 27 2011 GPL
drwxr-xr-x. 3 root root 2048 May 27 2011 HighAvailability
drwxr-xr-x. 3 root root 2048 May 27 2011 images
drwxr-xr-x. 2 root root 2048 May 27 2011 isolinux
drwxr-xr-x. 3 root root 2048 May 27 2011 LoadBalancer
-rw-r--r--. 1 root root 98 May 27 2011 media.repo
drwxr-xr-x. 2 root root 636928 May 27 2011 Packages
-rw-r--r--. 1 root root 2619 May 27 2011 README-en
-rw-r--r--. 1 root root 7054 May 27 2011 README-en.html
-rw-r--r--. 1 root root 17643 May 27 2011 RELEASE-NOTES-en
-rw-r--r--. 1 root root 20003 May 27 2011 RELEASE-NOTES-en.html
-rw-r--r--. 1 root root 17643 May 27 2011 RELEASE-NOTES-x86_64-en
-rw-r--r--. 1 root root 20003 May 27 2011 RELEASE-NOTES-x86_64-en.html
-rw-r--r--. 1 root root 17643 May 27 2011 RELEASE-NOTES-x86-en
-rw-r--r--. 1 root root 20003 May 27 2011 RELEASE-NOTES-x86-en.html
lrwxrwxrwx. 1 root root 15 May 27 2011 repodata -> Server/repodata
drwxr-xr-x. 3 root root 2048 May 27 2011 ResilientStorage
-rw-r--r--. 1 root root 1011 May 27 2011 RPM-GPG-KEY
-rw-r--r--. 1 root root 1011 May 27 2011 RPM-GPG-KEY-oracle
drwxr-xr-x. 3 root root 2048 May 27 2011 ScalableFileSystem
drwxr-xr-x. 4 root root 2048 May 27 2011 Server
-rw-r--r--. 1 root root 108 May 27 2011 supportinfo
-r--r--r--. 1 root root 6301 May 27 2011 TRANS.TBL
[[email protected] mnt]# cd Packages/
[[email protected] Packages]# yum install lvm*
[[email protected] Packages]# rpm -qa |grep lvm
lvm2-libs-2.02.83-3.el6.x86_64
lvm2-2.02.83-3.el6.x86_64
[[email protected] Packages]# cd
[[email protected] ~]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created
[[email protected] ~]# pvcreate /dev/sdd
Physical volume "/dev/sdd" successfully created
[[email protected] ~]# pvcreate /dev/sde
Physical volume "/dev/sde" successfully created
[[email protected] ~]# pvcreate /dev/sdf
Physical volume "/dev/sdf" successfully created
[[email protected] ~]# lvmdiskscan
/dev/ram0 [ 16.00 MiB]
/dev/ram1 [ 16.00 MiB]
/dev/sda1 [ 200.00 MiB]
/dev/ram2 [ 16.00 MiB]
/dev/sda2 [ 1.46 GiB]
/dev/ram3 [ 16.00 MiB]
/dev/sda3 [ 18.34 GiB]
/dev/ram4 [ 16.00 MiB]
/dev/sda4 [ 19.99 GiB]
/dev/ram5 [ 16.00 MiB]
/dev/ram6 [ 16.00 MiB]
/dev/ram7 [ 16.00 MiB]
/dev/ram8 [ 16.00 MiB]
/dev/ram9 [ 16.00 MiB]
/dev/ram10 [ 16.00 MiB]
/dev/ram11 [ 16.00 MiB]
/dev/ram12 [ 16.00 MiB]
/dev/ram13 [ 16.00 MiB]
/dev/ram14 [ 16.00 MiB]
/dev/ram15 [ 16.00 MiB]
/dev/sdb1 [ 30.00 GiB]
/dev/sdc [ 5.00 GiB] LVM physical volume
/dev/sdd [ 5.00 GiB] LVM physical volume
/dev/sde [ 5.00 GiB] LVM physical volume
/dev/sdf [ 5.00 GiB] LVM physical volume
0 disks
21 partitions
4 LVM physical volume whole disks
0 LVM physical volumes
[[email protected] ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdc lvm2 a- 5.00g 5.00g
/dev/sdd lvm2 a- 5.00g 5.00g
/dev/sde lvm2 a- 5.00g 5.00g
/dev/sdf lvm2 a- 5.00g 5.00g
[[email protected] ~]# pvscan
PV /dev/sdc lvm2 [5.00 GiB]
PV /dev/sdd lvm2 [5.00 GiB]
PV /dev/sde lvm2 [5.00 GiB]
PV /dev/sdf lvm2 [5.00 GiB]
Total: 4 [20.00 GiB] / in use: 0 [0 ] / in no VG: 4 [20.00 GiB]
[[email protected] ~]# pvdisplay
"/dev/sdc" is a new physical volume of "5.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdc
VG Name
PV Size 5.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID l9WHQw-iiEw-6bcM-5cA3-AmRN-13vE-FSR1mE

"/dev/sdd" is a new physical volume of "5.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdd
VG Name
PV Size 5.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID GdU1Wp-KXFM-pgvy-DmFk-h72v-tBQs-CO57Eq

"/dev/sde" is a new physical volume of "5.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sde
VG Name
PV Size 5.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID ayVCDe-OCOY-yYVY-NeB9-48dQ-eP1e-6yVjkU

"/dev/sdf" is a new physical volume of "5.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdf
VG Name
PV Size 5.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID ZErfJH-ZyJz-QjBS-AWMv-BL03-d0Yq-dAaQbZ

[[email protected] ~]# vgcreate datavg /dev/sdc /dev/sdd /dev/sde /dev/sdf
Volume group "datavg" successfully created
[[email protected] ~]# vgchange -a y datavg
0 logical volume(s) in volume group "datavg" now active
[[email protected] ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "datavg" using metadata type lvm2
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
datavg 4 0 0 wz--n- 19.98g 19.98g
[[email protected] ~]# vgdiskplay
-bash: vgdiskplay: command not found
[[email protected] ~]# vgdisplay
--- Volume group ---
VG Name datavg
System ID
Format lvm2
Metadata Areas 4
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 4
Act PV 4
VG Size 19.98 GiB
PE Size 4.00 MiB
Total PE 5116
Alloc PE / Size 0 / 0
Free PE / Size 5116 / 19.98 GiB
VG UUID 8ipavP-2HNI-Qx7Q-jCnA-8XVZ-cpWl-UUmEOv

[[email protected] ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdc
VG Name datavg
PV Size 5.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 1279
Free PE 1279
Allocated PE 0
PV UUID l9WHQw-iiEw-6bcM-5cA3-AmRN-13vE-FSR1mE

--- Physical volume ---
PV Name /dev/sdd
VG Name datavg
PV Size 5.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 1279
Free PE 1279
Allocated PE 0
PV UUID GdU1Wp-KXFM-pgvy-DmFk-h72v-tBQs-CO57Eq

--- Physical volume ---
PV Name /dev/sde
VG Name datavg
PV Size 5.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 1279
Free PE 1279
Allocated PE 0
PV UUID ayVCDe-OCOY-yYVY-NeB9-48dQ-eP1e-6yVjkU

--- Physical volume ---
PV Name /dev/sdf
VG Name datavg
PV Size 5.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 1279
Free PE 1279
Allocated PE 0
PV UUID ZErfJH-ZyJz-QjBS-AWMv-BL03-d0Yq-dAaQbZ

[[email protected] ~]# vgdisplay datavg| grep "Total PE"
Total PE 5116
[[email protected] ~]# lvcreate -l 5116 datavg -n datalv
Logical volume "datalv" created
[[email protected] ~]# ls -l /dev/datavg/datalv
lrwxrwxrwx. 1 root root 7 May 25 11:07 /dev/datavg/datalv -> ../dm-0
[[email protected] ~]# mkfs.ext4 /dev/datavg/datalv
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
1310720 inodes, 5238784 blocks
261939 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
160 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

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 19G 11G 6.5G 63% /
tmpfs 995M 238M 758M 24% /dev/shm
/dev/sda1 194M 46M 139M 25% /boot
/dev/sda4 20G 1.4G 18G 7% /rman
/dev/sdb1 30G 863M 28G 4% /arch1
/dev/sr0 3.4G 3.4G 0 100% /mnt
[[email protected] ~]# mkdir /data
[[email protected] ~]# mount /dev/datavg/datalv /data
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 19G 11G 6.5G 63% /
tmpfs 995M 238M 758M 24% /dev/shm
/dev/sda1 194M 46M 139M 25% /boot
/dev/sda4 20G 1.4G 18G 7% /rman
/dev/sdb1 30G 863M 28G 4% /arch1
/dev/sr0 3.4G 3.4G 0 100% /mnt
/dev/mapper/datavg-datalv
20G 172M 19G 1% /data
[[email protected] ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed May 20 23:07:53 2015
#
# 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=30e46482-1e22-413f-bf77-e47497788434 / ext4 defaults 1 1
UUID=3b639602-3e2f-4533-80fc-73688caf0e03 /boot ext4 defaults 1 2
UUID=10a04773-55e4-44d4-91cb-0f5aa339be00 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/sda4 /rman ext3 defaults 1 1
/dev/sdb1 /arch1 ext3 defaults 1 1
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~

#
# /etc/fstab
# Created by anaconda on Wed May 20 23:07:53 2015
#
# 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=30e46482-1e22-413f-bf77-e47497788434 / ext4 defaults 1 1
UUID=3b639602-3e2f-4533-80fc-73688caf0e03 /boot ext4 defaults 1 2
UUID=10a04773-55e4-44d4-91cb-0f5aa339be00 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/sda4 /rman ext3 defaults 1 1
"/etc/fstab" 18L, 1033C written
[[email protected] ~]#
[[email protected] ~]#

时间: 2024-10-11 22:08:27

Linux卷管理的相关文章

linux逻辑卷管理

最近在进行linux充电,根据网络资料自己整理的资料,分享一下 ---------------------------------------------------------- Linux逻辑卷管理 1.什么是逻辑卷? LVM是逻辑卷管理(Logical Volume Manager)的简称,他是建立在物理存储设备之上的一个抽象层,允许你生成逻辑存储卷,和直接使用物理存储在管理上相比,提供了更好灵活性. LVM将存储虚拟化,使用逻辑卷,你不会受限于物理磁盘的大小,另外,和硬件相关的存储设置被

Linux磁盘管理:LVM逻辑卷创建及使用

Linux磁盘管理:LVM逻辑卷创建及使用    一.创建LVM逻辑卷    通过图文并茂的方式来看看如何创建我们的LVM ,首先是要将我们的物理硬盘格式化成PV,然后将多个PV加入到创建好的VG中,最后通过VG创建我们的LV.所以我们第一步就是将我们的物理硬盘格式化成PV(物理卷) ①将物理硬盘格式化成PV(物理卷) 使用的是 pvcreate 命令 这里我已经事先虚拟化了3快物理硬盘,每块硬盘的大小为8G,通过 fdisk -l 命令可以查看 [[email protected] ~]# f

【转载】Linux磁盘管理:LVM逻辑卷管理

Linux学习之CentOS(二十五)--Linux磁盘管理:LVM逻辑卷基本概念及LVM的工作原理 这篇随笔将详细讲解Linux磁盘管理机制中的LVM逻辑卷的基本概念以及LVM的工作原理!!! 一.传统的磁盘管理 其实在Linux操作系统中,我们的磁盘管理机制和windows上的差不多,绝大多数都是使用MBR(Master Boot Recorder)都是通过先对一个硬盘进行分区,然后再将该分区进行文件系统的格式化,在Linux系统中如果要使用该分区就将其挂载上去即可,windows的话其实底

[Linux] centOS 6.5 LVM 逻辑卷 管理 实验报告

目录 1.      LVM 简介 2.      LVM基本术语 3.      LVM的安装 4.      LVM的使用 4.1        物理卷的管理 4.2        卷组的管理: 4.3        逻辑卷的管理: 5.      一个例子 5.1        练习: 5.2        开始部署 1.   LVM 简介 LVM逻辑卷管理器(英语:Logical Volume Manager,缩写为LVM),又译为逻辑卷宗管理器.逻辑扇区管理器.逻辑磁盘管理器,是Lin

LINUX 逻辑卷管理: LVM

1.什么是LVM lvm是一个逻辑卷管理工具,它有两个版本,lvm1 和lvm2. 分别在2.4 kernal和2.6kernal里原生支持. LVM提供对磁盘分区更高逻辑层级的管理功能.通过lvm可以重新划分和移动存储卷. LVM可以对逻辑卷自定义命名成development , sales等指定名称,而不是"sda""sdb" 2.一个案例说明LVM的好处:Joe的PC As an example: Joe buys a PC with an 8.4 Gigab

linux基础知识——————逻辑卷管理器(lvm)

*****什么是lvm:           lvm就是将几个物理的分区通过软件组合成为一块看起来是独立的大磁盘(vg),然后将这块大磁盘分成可使用的分区. 然后就可以格式化创建文件系统,最终可以挂载使用啦.   *****我们该如何创建lvm呢? 一.首先创建分区,将其id设为8e,如下图   二.然后创建pv      pv阶段有如下常用的命令 pvcreate : 将物理的分区创建为pv pvscan  : 查看磁盘里的所有pv的信息 pvdiplay :查看pv的状态 pvremove

Linux常用命令(八)LVM逻辑卷管理

一.LVM概述     LVM是Linux系统中对磁盘分区进行管理的一种逻辑机制,它是建立在硬盘和分区之上,文件系统之下的一个逻辑层,在建立文件系统时屏蔽了下层的磁盘分区布局,能够在保持现有数据不变的情况下动态调整磁盘容量,从而提高磁盘管理的灵活性. 需要注意的是,"/boot"分区不能基于LVM创建,必须独立出来. 1.pv(PhysicalVolume,物理卷) 物理卷是LVM机制的基本存储设备,通常对应一个普通分区或整个硬盘.创建物理卷时,会在分区或硬盘的头部创建一个保留区块,用

Linux下逻辑卷管理

LVM --Logical Volume Manager (逻辑卷管理)  逻辑卷管理是Linux环境下对磁盘分区进行管理的一种机制,LVM是建立在硬盘和分区之上的一个逻辑层,用来提高磁盘分区管理的灵活性. 一.优点 磁盘空间的动态划分和管理实现分区的动态拉伸和回缩 二.逻辑卷管理的组成 1.物理卷(PV--PvcreateVolume) 物理卷在逻辑卷管理中处于最底层,它可以是实际物理硬盘上的分区,也可以是整个物理硬盘.2.卷组(VG--Vgcreate Group) 卷组建立在物理卷之上,一

Linux的lvm逻辑卷管理

一.LVM简介 LVM是 Logical Volume Manager(逻辑卷管理)的简写,它由Heinz Mauelshagen在Linux 2.4内核上实现.LVM将一个或多个硬盘的分区在逻辑上集合,相当于一个大硬盘来使用,当硬盘的空间不够使用的时候,可以继续将其它的硬盘的分区加入其中,这样可以实现磁盘空间的动态管理,相对于普通的磁盘分区有很大的灵活性. 与传统的磁盘与分区相比,LVM为计算机提供了更高层次的磁盘存储.它使系统管理员可以更方便的为应用与用户分配存储空间.在LVM管理下的存储卷