topimg.jpg


スポンサーサイト

上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。
  1. --/--/--(--) --:--:--|
  2. スポンサー広告

LinuxにおけるLVの削除/拡張/縮小

●LV削除 ※アンマウント必須
[root@localhost tmp]# vgdisplay -C
VG #PV #LV #SN Attr VSize VFree
sharevg 1 2 0 wz--n- 79.97g 0
[root@localhost tmp]# lvdisplay -C
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
sharelv1 sharevg -wi-ao 20.00g
sharelv2 sharevg -wi-a- 59.97g


[root@localhost tmp]# umount /dev/sharevg/sharelv1

[root@localhost tmp]# lvremove /dev/sharevg/sharelv1
Do you really want to remove active logical volume sharelv1? [y/n]: y
Logical volume "sharelv1" successfully removed

[root@localhost tmp]# vgdisplay -C
VG #PV #LV #SN Attr VSize VFree
sharevg 1 1 0 wz--n- 79.97g 20.00g
[root@localhost tmp]# lvdisplay -C
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
sharelv2 sharevg -wi-a- 59.97g

●拡張
1.LV拡張(60GB⇒+20GB) ※マウントしていても実行可
[root@localhost tmp]# lvdisplay -C
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
sharelv2 sharevg -wi-ao 59.97g

[root@localhost tmp]# lvresize -L +20G /dev/mapper/sharevg-sharelv2
Extending logical volume sharelv2 to 79.97 GiB
Logical volume sharelv2 successfully resized

[root@localhost tmp]# lvdisplay -C
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
sharelv2 sharevg -wi-ao 79.97g

2.ファイルシステム拡張(60GB⇒LVの最大サイズ) ※マウントしていても実行可(ext3の場合)
[root@localhost tmp]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda3 ext3 2356764 1395584 835472 63% /
tmpfs tmpfs 505780 172 505608 1% /dev/shm
/dev/sda1 ext3 101086 17987 77880 19% /boot
/dev/mapper/sharevg-sharelv2
ext3 61927420 184268 58597428 1% /tmp/test

[root@localhost tmp]# resize2fs /dev/sharevg/sharelv2
resize2fs 1.41.14 (22-Dec-2010)
Filesystem at /dev/sharevg/sharelv2 is mounted on /tmp/test; on-line resizing required
old desc_blocks = 4, new_desc_blocks = 5
Performing an on-line resize of /dev/sharevg/sharelv2 to 20963328 (4k) blocks.
The filesystem on /dev/sharevg/sharelv2 is now 20963328 blocks long.

[root@localhost tmp]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda3 ext3 2356764 1395588 835468 63% /
tmpfs tmpfs 505780 172 505608 1% /dev/shm
/dev/sda1 ext3 101086 17987 77880 19% /boot
/dev/mapper/sharevg-sharelv2
ext3 82537136 188292 78156440 1% /tmp/test


●縮小
1.ファイルシステム縮小(80GB⇒60GB)※アンマウント必須
[root@localhost tmp]# umount /dev/mapper/sharevg-sharelv2
[root@localhost tmp]# fsck.ext3 -f /dev/mapper/sharevg-sharelv2
e2fsck 1.41.14 (22-Dec-2010)
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/mapper/sharevg-sharelv2: 11/5242880 files (0.0% non-contiguous), 376117/20963328 blocks

[root@localhost tmp]# resize2fs /dev/mapper/sharevg-sharelv2 60G
resize2fs 1.41.14 (22-Dec-2010)
Resizing the filesystem on /dev/mapper/sharevg-sharelv2 to 15728640 (4k) blocks.
The filesystem on /dev/mapper/sharevg-sharelv2 is now 15728640 blocks long.

[root@localhost tmp]# mount /dev/sharevg/sharelv2 /tmp/test
[root@localhost tmp]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda3 ext3 2356764 1395512 835544 63% /
tmpfs tmpfs 505780 172 505608 1% /dev/shm
/dev/sda1 ext3 101086 17987 77880 19% /boot
/dev/mapper/sharevg-sharelv2
ext3 61927420 184268 58597428 1% /tmp/test

2.LV縮小(80GB⇒60GB)※マウントしていても実行可
[root@localhost tmp]# lvdisplay -C
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
sharelv2 sharevg -wi-ao 79.97g

[root@localhost tmp]# lvresize -L 60G /dev/mapper/sharevg-sharelv2
WARNING: Reducing active logical volume to 60.00 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce sharelv2? [y/n]: y
Reducing logical volume sharelv2 to 60.00 GiB
Logical volume sharelv2 successfully resized

[root@localhost tmp]# lvdisplay -C
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
sharelv2 sharevg -wi-a- 60.00g



●参考
LVM上のファイルシステムをリサイズ(拡張/縮小)する
http://l-w-i.net/t/fedora/lvm_003.txt
スポンサーサイト
  1. 2013/01/21(月) 02:58:00|
  2. Linux/Unix
  3. | トラックバック:0
  4. | コメント:1

LinuxでLVMを利用したディスクマウント手順

●手順
1.LVMパーティション作成
[root@localhost ~]# fdisk -l

Disk /dev/sda: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders, total 6291456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005e88b

Device Boot Start End Blocks Id System
/dev/sda1 * 63 208844 104391 83 Linux
/dev/sda2 208845 1253069 522112+ 82 Linux swap / Solaris
/dev/sda3 1253070 6281414 2514172+ 83 Linux

Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders, total 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00086bf8

Device Boot Start End Blocks Id System
[root@localhost ~]# fdisk /dev/sdb

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-167772159, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-167772159, default 167772159):
Using default value 167772159

Command (m for help): p

Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders, total 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00086bf8

Device Boot Start End Blocks Id System
/dev/sdb1 2048 167772159 83885056 83 Linux

Command (m for help): t
Selected partition 1
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: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders, total 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00086bf8

Device Boot Start End Blocks Id System
/dev/sdb1 2048 167772159 83885056 8e Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk -l

Disk /dev/sda: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders, total 6291456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005e88b

Device Boot Start End Blocks Id System
/dev/sda1 * 63 208844 104391 83 Linux
/dev/sda2 208845 1253069 522112+ 82 Linux swap / Solaris
/dev/sda3 1253070 6281414 2514172+ 83 Linux

Disk /dev/sdb: 85.9 GB, 85899345920 bytes
86 heads, 10 sectors/track, 195083 cylinders, total 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00086bf8

Device Boot Start End Blocks Id System
/dev/sdb1 2048 167772159 83885056 8e Linux LVM



2.PV作成
[root@localhost ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
[root@localhost ~]# pvdisplay
"/dev/sdb1" is a new physical volume of "80.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 80.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID bRXIem-T54a-MYdY-Vncg-kC6f-493I-OPKwZz
[root@localhost ~]# pvdisplay -C
PV VG Fmt Attr PSize PFree
/dev/sdb1 lvm2 a- 80.00g 80.00g

3.VG作成
[root@localhost ~]# vgcreate sharevg /dev/sdb1
Volume group "sharevg" successfully created
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name sharevg
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 80.00 GiB
PE Size 4.00 MiB
Total PE 20479
Alloc PE / Size 0 / 0
Free PE / Size 20479 / 80.00 GiB
VG UUID dJCKoE-fXTO-TYGx-Te75-DG4F-AmO5-BUz7Zi
[root@localhost ~]# vgdisplay -C
VG #PV #LV #SN Attr VSize VFree
sharevg 1 0 0 wz--n- 80.00g 80.00g

4.LV作成
[root@localhost ~]# lvcreate -L 20GB -n sharelv1 sharevg
Logical volume "sharelv1" created
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Name /dev/sharevg/sharelv1
VG Name sharevg
LV UUID 17fGww-xM8j-W2QC-p2Ks-fP6k-2X2c-4yRl5N
LV Write Access read/write
LV Status available
# open 0
LV Size 20.00 GiB
Current LE 640
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

[root@localhost ~]# lvdisplay -C
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
sharelv1 sharevg -wi-a- 20.00g

5.ファイルシステム作成
[root@localhost ~]# mkfs -t ext3 /dev/sharevg/sharelv1
mke2fs 1.41.14 (22-Dec-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, 5242880 blocks
262144 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 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.


6.LVのマウント
[root@localhost tmp]# mount /dev/sharevg/sharelv1 /tmp/test/
[root@localhost tmp]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda3 ext3 2356764 1394956 836100 63% /
tmpfs tmpfs 505780 176 505604 1% /dev/shm
/dev/sda1 ext3 101086 17987 77880 19% /boot
/dev/mapper/sharevg-sharelv1
ext3 20642428 176196 19417656 1% /tmp/test



●参考
LVMボリュームを作成する
http://l-w-i.net/t/fedora/lvm_001.txt
  1. 2013/01/21(月) 01:53:23|
  2. Linux/Unix
  3. | トラックバック:0
  4. | コメント:0

VMware ESXi 5.1の無償版ライセンスキー

VMware ESXi 5.1の無償版ライセンスキーを確認できる場所。


https://my.vmware.com/jp/group/vmware/evalcenter?p=free-esxi5&lp=default
 ⇒「ライセンス情報」


ダウンロードのリンクに気をとられて、ずっとライセンスキーを探しまくっていた。
灯台下暗しというやつですな。
  1. 2013/01/14(月) 03:39:29|
  2. 仮想化
  3. | トラックバック:0
  4. | コメント:0
上記広告は1ヶ月以上更新のないブログに表示されています。新しい記事を書くことで広告を消せます。