turboLinux_White Box Enterprise Linux_Fedora Core_Red Hat Memo/LVM
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
**LVMの操作 [#rd7c7df4]
RIGHT:更新日 &lastmod();
Disk2 Disk3 Disk4
---------- ----------- ----------
| | | | | |
| XXGB | | YYG | | ZZGB | 物理Disk
| | | | | |
---------- ----------- ----------
| | |
V V V
---------- ----------- ----------
| | | | | |
| sdb1 | | sdc1 | | sdd1 | 物理ボリュ...
| | | | | |
---------- ----------- ----------
| | |
V V V
-----------------------------------------
| | 論理ボリュ...
| Volume 00 |
-----------------------------------------
| |
V V
---------------- -----------------
| | | | 論理ボリュ...
| Log Vol 01 | | Log Vol 02 |
---------------- -----------------
| |
V V
/mnt1 /mnt2 マウントポ...
***物理ボリュームの作成 [#r1c9aed2]
# /sbin/fdisk /dev/sdb1
/dev/sdb1 1 783 6289416 8e ...
# /sbin/fdisk -l
Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id ...
/dev/sdb1 1 783 6289416 8e ...
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id ...
/dev/sdc1 1 1044 8385898+ 8e ...
Disk /dev/sde: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id ...
/dev/sde1 1 1305 10482381 8e ...
***物理ボリュームの作成 [#v230b637]
パーティションを物理ボリュームとして初期化
# /usr/sbin/pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
# /usr/sbin/pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
# /usr/sbin/pvcreate /dev/sde1
Physical volume "/dev/sde1" successfully created
LVMの領域として利用するすべての物理ボリュームに対して、初...
# /sbin/pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [15.88 GB / 0 ...
PV /dev/sdb1 lvm2 [6.00 GB]
PV /dev/sdc1 lvm2 [8.00 GB]
PV /dev/sde1 lvm2 [10.00 GB]
Total: 4 [39.87 GB] / in use: 1 [15.88 GB] / in no VG:...
***ボリュームグループの作成 [#wc95adf8]
# /usr/sbin/vgcreate VolGroup01 /dev/sdb1 /dev/sdc1 /dev...
Volume group "VolGroup01" successfully created
***ボリュームグループの確認 [#s7116984]
# /sbin/vgscan
Reading all physical volumes. This may take a while...
Found volume group "VolGroup01" using metadata type lvm2
Found volume group "VolGroup00" using metadata type lvm2
***ボリュームグループの削除 [#v78259d8]
# /usr/sbin/vgremove Volume00
Volume group "Volume00" successfully removed
''PE(Physical Extent) ''
ボリュームグループはPEという単位の集まり、PEの大きさはデ...
***論理ボリュームの作成 [#k48cdce2]
7GBの論理ボリューム(LogVol01)をボリュームグループ(VolGrou...
# /usr/sbin/lvcreate -L 7G -n LogVol01 VolGroup01
Logical volume "LogVol01" created
***論理ボリュームの確認 [#l886aeed]
# /usr/sbin/lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup01/LogVol01
VG Name VolGroup01
LV UUID 8vxvb9-1O1c-EwyS-W5N9-Fpsv-g8xO...
LV Write Access read/write
LV Status available
# open 0
LV Size 7.00 GB
Current LE 1792
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
***論理ボリュームの削除 [#e19b65ad]
# /usr/sbin/lvremove /dev/VolGroup01/LogVol01
Do you really want to remove active logical volume LogVo...
Logical volume "LogVol01" successfully removed
「/dev/ボリュームグループ名/論理ボリューム名」となる
***論理ボリュームのフォーマット [#g92970cb]
# /sbin/mkfs -t ext3 /dev/VolGroup01/LogVol11
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
(略)
This filesystem will be automatically checked every 34 m...
180 days, whichever comes first. Use tune2fs -c or -i t...
''マウント''
# mount /dev/VolGroup01/LogVol11 /mnt1
# mount
/dev/mapper/VolGroup01-LogVol11 on /mnt1 type ext3 (rw)
**LVの拡大/縮小 [#e19dc0ad]
***LVのサイズ拡大 [#v1428ee9]
# /usr/sbin/lvextend -L +1024M /dev/VolGroup01/LogVol11
Extending logical volume LogVol11 to 8.00 GB
Logical volume LogVol11 successfully resized
***FileSystemの拡大(ext3/ext4) [#ibead5f9]
# /sbin/resize2fs /dev/VolGroup01/LogVol11
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup01/LogVol11 is mounted on /mn...
Performing an on-line resize of /dev/VolGroup01/LogVol11...
The filesystem on /dev/VolGroup01/LogVol11 is now 209715...
# df
/dev/mapper/VolGroup01-LogVol11
8256952 363528 7474008 5% ...
***LVのサイズ縮小 [#oce3dd4d]
縮小時はumountの必要あり
FileSystemの縮小(ext3/ext4)(6GBに)
# umount /mnt1
# /sbin/fsck.ext3 -f /dev/VolGroup01/LogVol11
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/VolGroup01/LogVol11: 10076/1048576 files (0.1% non-...
# /sbin/resize2fs /dev/VolGroup01/LogVol11 6G
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/VolGroup01/LogVol11 to 1...
The filesystem on /dev/VolGroup01/LogVol11 is now 157286...
***LVのサイズ縮小(-2GB) [#aa47800e]
# /usr/sbin/lvreduce -L -2GB /dev/VolGroup01/LogVol11
WARNING: Reducing active logical volume to 6.00 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol11? [y/n]: y
Reducing logical volume LogVol11 to 6.00 GB
Logical volume LogVol11 successfully resized
# mount -t ext3 /dev/VolGroup01/LogVol11 /mnt
# df
/dev/mapper/VolGroup01-LogVol11
6192704 361740 5579308 7% /...
**VGにPV追加・切り離し [#v543040c]
***ボリュームグループ(VolGroup01:24GB)に物理ボリューム(...
# /usr/sbin/vgdisplay VolGroup01
--- Volume group ---
VG Name VolGroup01
System ID
Format lvm2
(略)
VG Size 23.99 GB <==元容量
PE Size 4.00 MB
Total PE 6141
Alloc PE / Size 1536 / 6.00 GB
Free PE / Size 4605 / 17.99 GB
VG UUID BaY2tc-6r9Q-00nn-rE7D-cjsj-f5jH-...
''追加''
# /usr/sbin/vgextend VolGroup01 /dev/sdf
Volume group "VolGroup01" successfully extended
# /usr/sbin/vgdisplay VolGroup01
--- Volume group ---
VG Name VolGroup01
System ID
Format lvm2
(略)
VG Size 27.98 GB <= sdf 4GBが追加された
PE Size 4.00 MB
Total PE 7164
Alloc PE / Size 1536 / 6.00 GB
Free PE / Size 5628 / 21.98 GB
VG UUID BaY2tc-6r9Q-00nn-rE7D-cjsj-f5jH-...
***ボリュームグループから物理ボリュームを切り離し [#x8701...
PV内のPE(Physical Extent:物理エクステント)を同一VG内の別...
''PE移動''
# /usr/sbin/pvmove /dev/sdc1
/dev/sdc1: Moved: 0.1%
/dev/sdc1: Moved: 13.9%
(略)
/dev/sdc1: Moved: 93.8%
/dev/sdc1: Moved: 100.0%
''切り離し''
# /usr/sbin/vgreduce VolGroup01 /dev/sdc1
Removed "/dev/sdc1" from volume group "VolGroup01"
# /usr/sbin/pvdisplay /dev/sdc1
"/dev/xvdc1" is a new physical volume of "8.00 GB"
--- NEW Physical volume ---
PV Name /dev/sdc1
VG Name
PV Size 8.00 GB <=sdcの容量
(略)
Allocated PE 0
PV UUID N1hPFy-W0jy-uLN1-4DOT-5ZKk-ZczK-...
''確認''
# /usr/sbin/vgdisplay VolGroup01
--- Volume group ---
VG Name VolGroup01
System ID
(略)
VG Size 19.99 GB <= 元 28GBからsdc(8GB)...
PE Size 4.00 MB
Total PE 5117
Alloc PE / Size 1536 / 6.00 GB
Free PE / Size 3581 / 13.99 GB
VG UUID BaY2tc-6r9Q-00nn-rE7D-cjsj-f5jH-...
PE(8MBにして)を変更してボリュームグループの作成
# /usr/sbin/vgcreate -s 8M VolGroup02 /dev/sdc1
Volume group "VolGroup02" successfully created
# /usr/sbin/vgdisplay /dev/VolGroup02
--- Volume group ---
VG Name VolGroup02
System ID
Format lvm2
(略)
VG Size 7.99 GB
PE Size 8.00 MB <=8Mになっている
Total PE 1023
Alloc PE / Size 0 / 0
Free PE / Size 1023 / 7.99 GB
VG UUID clPzPe-MGoD-3wsG-LzVg-Lv4J-IjkC-c...
**Raid1 [#ee4de1b2]
Raid1を作成後、ボリュームグループの作成 する例
Raid1デバイス(/dev/md0)を/dev/xvdg1,/dev/xvdh1から作成
# /sbin/mdadm --create /dev/md0 --level=1 --raid-devices...
mdadm: /dev/xvdg1 appears to contain an ext2fs file system
size=987964K mtime=Thu Jan 1 09:00:00 1970
mdadm: /dev/xvdh1 appears to contain an ext2fs file system
size=987964K mtime=Thu Jan 1 09:00:00 1970
Continue creating array? y
mdadm: array /dev/md0 started.
# /sbin/mdadm --detail --scan >> /etc/mdadm.conf
物理ボリュームとして初期化
# /usr/sbin/pvcreate /dev/md0
Physical volume "/dev/md0" successfully created
ボリュームグループの作成
# /usr/sbin/vgcreate VolGroup03 /dev/md0
Volume group "VolGroup03" successfully created
論理ボリュームの作成
# /usr/sbin/lvcreate -L 960M -n LogVol_raid01 VolGroup03
Logical volume "LogVol_raid01" created
Format後、/mnt-raidにmount
# /sbin/mkfs -t ext3 /dev/VolGroup03/LogVol_raid01
# mkdir /mnt-raid
# mount /dev/VolGroup03/LogVol_raid01 /mnt-raid
**参考 [#g5a4b357]
-https://www.miraclelinux.com/technet/document/linux/trai...
http://pantora.net/pages/linux/lvm/3/
終了行:
**LVMの操作 [#rd7c7df4]
RIGHT:更新日 &lastmod();
Disk2 Disk3 Disk4
---------- ----------- ----------
| | | | | |
| XXGB | | YYG | | ZZGB | 物理Disk
| | | | | |
---------- ----------- ----------
| | |
V V V
---------- ----------- ----------
| | | | | |
| sdb1 | | sdc1 | | sdd1 | 物理ボリュ...
| | | | | |
---------- ----------- ----------
| | |
V V V
-----------------------------------------
| | 論理ボリュ...
| Volume 00 |
-----------------------------------------
| |
V V
---------------- -----------------
| | | | 論理ボリュ...
| Log Vol 01 | | Log Vol 02 |
---------------- -----------------
| |
V V
/mnt1 /mnt2 マウントポ...
***物理ボリュームの作成 [#r1c9aed2]
# /sbin/fdisk /dev/sdb1
/dev/sdb1 1 783 6289416 8e ...
# /sbin/fdisk -l
Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id ...
/dev/sdb1 1 783 6289416 8e ...
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id ...
/dev/sdc1 1 1044 8385898+ 8e ...
Disk /dev/sde: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id ...
/dev/sde1 1 1305 10482381 8e ...
***物理ボリュームの作成 [#v230b637]
パーティションを物理ボリュームとして初期化
# /usr/sbin/pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
# /usr/sbin/pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
# /usr/sbin/pvcreate /dev/sde1
Physical volume "/dev/sde1" successfully created
LVMの領域として利用するすべての物理ボリュームに対して、初...
# /sbin/pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [15.88 GB / 0 ...
PV /dev/sdb1 lvm2 [6.00 GB]
PV /dev/sdc1 lvm2 [8.00 GB]
PV /dev/sde1 lvm2 [10.00 GB]
Total: 4 [39.87 GB] / in use: 1 [15.88 GB] / in no VG:...
***ボリュームグループの作成 [#wc95adf8]
# /usr/sbin/vgcreate VolGroup01 /dev/sdb1 /dev/sdc1 /dev...
Volume group "VolGroup01" successfully created
***ボリュームグループの確認 [#s7116984]
# /sbin/vgscan
Reading all physical volumes. This may take a while...
Found volume group "VolGroup01" using metadata type lvm2
Found volume group "VolGroup00" using metadata type lvm2
***ボリュームグループの削除 [#v78259d8]
# /usr/sbin/vgremove Volume00
Volume group "Volume00" successfully removed
''PE(Physical Extent) ''
ボリュームグループはPEという単位の集まり、PEの大きさはデ...
***論理ボリュームの作成 [#k48cdce2]
7GBの論理ボリューム(LogVol01)をボリュームグループ(VolGrou...
# /usr/sbin/lvcreate -L 7G -n LogVol01 VolGroup01
Logical volume "LogVol01" created
***論理ボリュームの確認 [#l886aeed]
# /usr/sbin/lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup01/LogVol01
VG Name VolGroup01
LV UUID 8vxvb9-1O1c-EwyS-W5N9-Fpsv-g8xO...
LV Write Access read/write
LV Status available
# open 0
LV Size 7.00 GB
Current LE 1792
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
***論理ボリュームの削除 [#e19b65ad]
# /usr/sbin/lvremove /dev/VolGroup01/LogVol01
Do you really want to remove active logical volume LogVo...
Logical volume "LogVol01" successfully removed
「/dev/ボリュームグループ名/論理ボリューム名」となる
***論理ボリュームのフォーマット [#g92970cb]
# /sbin/mkfs -t ext3 /dev/VolGroup01/LogVol11
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
(略)
This filesystem will be automatically checked every 34 m...
180 days, whichever comes first. Use tune2fs -c or -i t...
''マウント''
# mount /dev/VolGroup01/LogVol11 /mnt1
# mount
/dev/mapper/VolGroup01-LogVol11 on /mnt1 type ext3 (rw)
**LVの拡大/縮小 [#e19dc0ad]
***LVのサイズ拡大 [#v1428ee9]
# /usr/sbin/lvextend -L +1024M /dev/VolGroup01/LogVol11
Extending logical volume LogVol11 to 8.00 GB
Logical volume LogVol11 successfully resized
***FileSystemの拡大(ext3/ext4) [#ibead5f9]
# /sbin/resize2fs /dev/VolGroup01/LogVol11
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup01/LogVol11 is mounted on /mn...
Performing an on-line resize of /dev/VolGroup01/LogVol11...
The filesystem on /dev/VolGroup01/LogVol11 is now 209715...
# df
/dev/mapper/VolGroup01-LogVol11
8256952 363528 7474008 5% ...
***LVのサイズ縮小 [#oce3dd4d]
縮小時はumountの必要あり
FileSystemの縮小(ext3/ext4)(6GBに)
# umount /mnt1
# /sbin/fsck.ext3 -f /dev/VolGroup01/LogVol11
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/VolGroup01/LogVol11: 10076/1048576 files (0.1% non-...
# /sbin/resize2fs /dev/VolGroup01/LogVol11 6G
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/VolGroup01/LogVol11 to 1...
The filesystem on /dev/VolGroup01/LogVol11 is now 157286...
***LVのサイズ縮小(-2GB) [#aa47800e]
# /usr/sbin/lvreduce -L -2GB /dev/VolGroup01/LogVol11
WARNING: Reducing active logical volume to 6.00 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol11? [y/n]: y
Reducing logical volume LogVol11 to 6.00 GB
Logical volume LogVol11 successfully resized
# mount -t ext3 /dev/VolGroup01/LogVol11 /mnt
# df
/dev/mapper/VolGroup01-LogVol11
6192704 361740 5579308 7% /...
**VGにPV追加・切り離し [#v543040c]
***ボリュームグループ(VolGroup01:24GB)に物理ボリューム(...
# /usr/sbin/vgdisplay VolGroup01
--- Volume group ---
VG Name VolGroup01
System ID
Format lvm2
(略)
VG Size 23.99 GB <==元容量
PE Size 4.00 MB
Total PE 6141
Alloc PE / Size 1536 / 6.00 GB
Free PE / Size 4605 / 17.99 GB
VG UUID BaY2tc-6r9Q-00nn-rE7D-cjsj-f5jH-...
''追加''
# /usr/sbin/vgextend VolGroup01 /dev/sdf
Volume group "VolGroup01" successfully extended
# /usr/sbin/vgdisplay VolGroup01
--- Volume group ---
VG Name VolGroup01
System ID
Format lvm2
(略)
VG Size 27.98 GB <= sdf 4GBが追加された
PE Size 4.00 MB
Total PE 7164
Alloc PE / Size 1536 / 6.00 GB
Free PE / Size 5628 / 21.98 GB
VG UUID BaY2tc-6r9Q-00nn-rE7D-cjsj-f5jH-...
***ボリュームグループから物理ボリュームを切り離し [#x8701...
PV内のPE(Physical Extent:物理エクステント)を同一VG内の別...
''PE移動''
# /usr/sbin/pvmove /dev/sdc1
/dev/sdc1: Moved: 0.1%
/dev/sdc1: Moved: 13.9%
(略)
/dev/sdc1: Moved: 93.8%
/dev/sdc1: Moved: 100.0%
''切り離し''
# /usr/sbin/vgreduce VolGroup01 /dev/sdc1
Removed "/dev/sdc1" from volume group "VolGroup01"
# /usr/sbin/pvdisplay /dev/sdc1
"/dev/xvdc1" is a new physical volume of "8.00 GB"
--- NEW Physical volume ---
PV Name /dev/sdc1
VG Name
PV Size 8.00 GB <=sdcの容量
(略)
Allocated PE 0
PV UUID N1hPFy-W0jy-uLN1-4DOT-5ZKk-ZczK-...
''確認''
# /usr/sbin/vgdisplay VolGroup01
--- Volume group ---
VG Name VolGroup01
System ID
(略)
VG Size 19.99 GB <= 元 28GBからsdc(8GB)...
PE Size 4.00 MB
Total PE 5117
Alloc PE / Size 1536 / 6.00 GB
Free PE / Size 3581 / 13.99 GB
VG UUID BaY2tc-6r9Q-00nn-rE7D-cjsj-f5jH-...
PE(8MBにして)を変更してボリュームグループの作成
# /usr/sbin/vgcreate -s 8M VolGroup02 /dev/sdc1
Volume group "VolGroup02" successfully created
# /usr/sbin/vgdisplay /dev/VolGroup02
--- Volume group ---
VG Name VolGroup02
System ID
Format lvm2
(略)
VG Size 7.99 GB
PE Size 8.00 MB <=8Mになっている
Total PE 1023
Alloc PE / Size 0 / 0
Free PE / Size 1023 / 7.99 GB
VG UUID clPzPe-MGoD-3wsG-LzVg-Lv4J-IjkC-c...
**Raid1 [#ee4de1b2]
Raid1を作成後、ボリュームグループの作成 する例
Raid1デバイス(/dev/md0)を/dev/xvdg1,/dev/xvdh1から作成
# /sbin/mdadm --create /dev/md0 --level=1 --raid-devices...
mdadm: /dev/xvdg1 appears to contain an ext2fs file system
size=987964K mtime=Thu Jan 1 09:00:00 1970
mdadm: /dev/xvdh1 appears to contain an ext2fs file system
size=987964K mtime=Thu Jan 1 09:00:00 1970
Continue creating array? y
mdadm: array /dev/md0 started.
# /sbin/mdadm --detail --scan >> /etc/mdadm.conf
物理ボリュームとして初期化
# /usr/sbin/pvcreate /dev/md0
Physical volume "/dev/md0" successfully created
ボリュームグループの作成
# /usr/sbin/vgcreate VolGroup03 /dev/md0
Volume group "VolGroup03" successfully created
論理ボリュームの作成
# /usr/sbin/lvcreate -L 960M -n LogVol_raid01 VolGroup03
Logical volume "LogVol_raid01" created
Format後、/mnt-raidにmount
# /sbin/mkfs -t ext3 /dev/VolGroup03/LogVol_raid01
# mkdir /mnt-raid
# mount /dev/VolGroup03/LogVol_raid01 /mnt-raid
**参考 [#g5a4b357]
-https://www.miraclelinux.com/technet/document/linux/trai...
http://pantora.net/pages/linux/lvm/3/
ページ名: