码迷,mamicode.com
首页 > 系统相关 > 详细

Linux卷管理

时间:2015-05-25 12:51:36      阅读:345      评论:0      收藏:0      [点我收藏+]

标签:

[root@linux ~]# 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
[root@linux ~]# 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
[root@linux ~]# 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
[root@linux ~]# ]pvcreate /dev/sdc
-bash: ]pvcreate: command not found

[root@linux mnt]# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@linux mnt]# cd /mnt/
[root@linux 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
[root@linux mnt]# cd Packages/
[root@linux Packages]# yum install lvm*
[root@linux Packages]# rpm -qa |grep lvm
lvm2-libs-2.02.83-3.el6.x86_64
lvm2-2.02.83-3.el6.x86_64
[root@linux Packages]# cd
[root@linux ~]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created
[root@linux ~]# pvcreate /dev/sdd
Physical volume "/dev/sdd" successfully created
[root@linux ~]# pvcreate /dev/sde
Physical volume "/dev/sde" successfully created
[root@linux ~]# pvcreate /dev/sdf
Physical volume "/dev/sdf" successfully created
[root@linux ~]# 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
[root@linux ~]# 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
[root@linux ~]# 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]
[root@linux ~]# 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

[root@linux ~]# vgcreate datavg /dev/sdc /dev/sdd /dev/sde /dev/sdf
Volume group "datavg" successfully created
[root@linux ~]# vgchange -a y datavg
0 logical volume(s) in volume group "datavg" now active
[root@linux ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "datavg" using metadata type lvm2
[root@linux ~]# vgs
VG #PV #LV #SN Attr VSize VFree
datavg 4 0 0 wz--n- 19.98g 19.98g
[root@linux ~]# vgdiskplay
-bash: vgdiskplay: command not found
[root@linux ~]# 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

[root@linux ~]# 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

[root@linux ~]# vgdisplay datavg| grep "Total PE"
Total PE 5116
[root@linux ~]# lvcreate -l 5116 datavg -n datalv
Logical volume "datalv" created
[root@linux ~]# ls -l /dev/datavg/datalv
lrwxrwxrwx. 1 root root 7 May 25 11:07 /dev/datavg/datalv -> ../dm-0
[root@linux ~]# 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.
[root@linux ~]# 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
[root@linux ~]# mkdir /data
[root@linux ~]# mount /dev/datavg/datalv /data
[root@linux ~]# 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
[root@linux ~]# 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
[root@linux ~]#
[root@linux ~]#

Linux卷管理

标签:

原文地址:http://www.cnblogs.com/jasoname/p/4527472.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!