Rabu, 04 Oktober 2017

Reduce and Create LVM on RHEL


h[root@twins /]#df –h

[root@twins /]#umount /home

[root@twins /]# lvreduce -L 40G /dev/mapper/VolGroup-lv_home

WARNING: Reducing active and open logical volume to 40.00 GiB

THIS MAY DESTROY YOUR DATA (filesystem etc.)

Do you really want to reduce lv_home? [y/n]: y

Reducing logical volume lv_home to 40.00 GiB

Logical volume lv_home successfully resized


[root@twins /]# mkfs -t ext4 /dev/mapper/VolGroup-lv_home

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

2621440 inodes, 10485760 blocks

524288 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

320 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, 7962624


Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 29 mounts or

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

[root@twins /]# mount /home/

[root@twins /]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root

50G 8.6G 39G 19% /

tmpfs 1.5G 88K 1.5G 1% /dev/shm

/dev/sdb1 485M 30M 430M 7% /boot

/dev/sda2 230G 210G 7.6G 97% /disk3

/dev/sda1 230G 229M 218G 1% /disk2

/dev/sr0 3.2G 3.2G 0 100% /DVDCD

/dev/mapper/VolGroup-lv_home

40G 176M 38G 1% /home


Membuat LV baru dengan sisa yang sudah kita reduce sebelumnya


[root@twins /]# lvcreate -L 53G -n temp VolGroup

Logical volume "temp" created

[root@twins /]# lvs

LV VG Attr LSize Origin Snap% Move Log Copy% Convert

lv_home VolGroup -wi-ao 40.00g

lv_root VolGroup -wi-ao 50.00g

lv_swap VolGroup -wi-ao 4.95g

temp VolGroup -wi-a- 53.00g

[root@twins /]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root

50G 8.6G 39G 19% /

tmpfs 1.5G 88K 1.5G 1% /dev/shm

/dev/sdb1 485M 30M 430M 7% /boot

/dev/sda2 230G 210G 7.6G 97% /disk3

/dev/sda1 230G 188M 218G 1% /disk2

/dev/sr0 3.2G 3.2G 0 100% /DVDCD

/dev/mapper/VolGroup-lv_home

40G 218M 38G 1% /home

[root@twins /]# mkfs -t ext4 /dev/mapper/VolGroup-temp

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

3473408 inodes, 13893632 blocks

694681 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

424 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, 7962624, 11239424


Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 33 mounts or

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

[root@twins /]# mkdir temporary

[root@twins /]# mount /dev/mapper/VolGroup-temp /temporary/

[root@twins /]# vi /etc/fstab =è> tambahkan di fstab

/dev/mapper/vg_twins-temp /temporary/




[root@twins temporary]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root 8.6G 39G 19% /

Tmpfs 1.5G 88K 1.5G 1% /dev/shm

/dev/sdb 1485M 30M 430M 7% /boot

/dev/sda 2230G 210G 7.6G 97% /disk3

/dev/sda 1230G 188M 218G 1% /disk2

/dev/sr0 3.2G 3.2G 0 100% /DVDCD

/dev/mapper/VolGroup-lv_home 40G 218M 38G 1% /home

/dev/mapper/VolGroup-temp 53G 180M 50G 1% /temporary

Tidak ada komentar:

Posting Komentar