You are on page 1of 22

LVM Disk Partition & XFS File System

Oracle Linux 7
Overview & Live Demo

Herwono W Wijaya
Founder LinuxCoding.org
Linux System Engineer
VMWare vExpert 2014

linuxcoding

Copyright
Copyright
2015
2015
LinuxCoding.org
nuxbrain and/its
and/its
affiliates,
affiliates,
All right
All right
reserved.
reserved.
|
|

Pada akhir sesi ini, anda akan dapat :

Mengenal LVM Disk Partition & XFS File System


Mengenal susunan pada LVM Disk Partition
Mengenal Disk Mapping dari LVM Disk Partition
Membuat, mengkonfigurasikan, incress size dan reduce size
LVM Disk Partition
Live Demo

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

LVM Disk Partition & XFS File System


Oracle Linux 7

Beberapa Sistem Operasi Linux


Yang menggunakan LVM & XFS sebagai defaultnya
Oracle Linux 7

RedHat 7

CentOS 7

LINUX

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

LVM Disk Partition & XFS File System


Oracle Linux 7

Keuntungan dari LVM Disk Partition :

Mudah dikonfigurasikan

Disk Scalability

Increase FS Size
Reduce FS Size

Disk Mapping

Disk Group

Dll

linuxcoding

/dev/sdb1
14%

/dev/sdb
17%

/dev/sda
50%

/dev/sda1
19%

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Devices Mapping)


LVM
LUKS

RAID

Path symlink
/dev/mapper/vg-lv
/dev/vg/lv

device
mapper

Path devices
/dev/dm-0
/dev/dm-1
/dev/dm-2
/dev/dm-X

linuxcoding

kernel

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Hierarchy)
FS /dev/vg_data/lv_data

logical volume

logical volume lainnya

volume group

physical volume
physical volume

sdb

linuxcoding

sda

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Operation)

LVM

Reduce
Capacity

LVM

FS

FS

LV

LV

VG

VG

PV

PV

data

Storage

growth

XFS + LVM

Increase
Capacity

Note:
PV (Phisical Volume)
VG (Volume Group)
LV (Logical Volume)
FS (File System)

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

LVM Disk Partition & XFS File System


Oracle Linux 7

Kekurangan space : 10Gb

file
file

Besar file data : 10Gb

file
/dev/sdc
size : 20Gb

Penambahan space : 20Gb

file
file

/dev/sdc1
pv : 20Gb

file
vg: vgdata
used : 100%

lv: lvdata
used : 100%

/dev/sdb1
pv : 10Gb

file
file
file
file

/dev/sdb
size : 20Gb

Besar Space LV (logical volume) = 10Gb


Besar file data = 9Gb
low lv space

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

Live Demo
LVM & XFS on Oracle Linux 7

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Create & Configuration)

[root@localhost~]#fdisk -l

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

10

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Create & Configuration)

[root@localhost~]#fdisk /dev/sdb

[root@localhost~]#fdisk /dev/sdb

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

11

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Create & Configuration)

[root@localhost~]#partprobe
[root@localhost~]#pvcreate /dev/sdb1
[root@localhost~]#pvcreate /dev/sdc1

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

12

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Create & Configuration)

[root@localhost~]#vgcreate vgdata /dev/sdb1


[root@localhost~]#vgs

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

13

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Create & Configuration)

[root@localhost~]#lvcreate -l +100%FREE -n lvdata vgdata


[root@localhost~]#lvs

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

14

LVM Disk Partition & XFS File System


Oracle Linux 7

(XFS Create File System)

[root@localhost~]# mkfs.xfs -L mydata /dev/mapper/vgdata-lvdata

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

15

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Increase)

[root@localhost~]# vgextend vgdata /dev/sdc1


[root@localhost~]# vgs

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

16

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Increase)

[root@localhost~]# lvextend -l +100%FREE lvdata


[root@localhost~]# lvs

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

17

LVM Disk Partition & XFS File System


Oracle Linux 7

(XFS Mounting & XFS Growfs)

[root@localhost~]# mkdir /lvm_demo


[root@localhost~]# mount /dev/vgdata/lvdata /lvm_demo

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

18

LVM Disk Partition & XFS File System


Oracle Linux 7

(XFS Mounting & XFS Growfs)

[root@localhost~]# xfs_growfs -d /lvm_demo/

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

19

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Reduce on XFS File System, Dump XFS, Restore XFS)


WARNING!
Dump / Backup XFS Data sebelum melakukan reduce pada LVM dengan XFS File System

[root@localhost~]# xfsdump -f /root/lv_data_dump /dev/vgdata/lvdata


[root@localhost~]# umount /lvm_demo
[root@localhost~]# lvreduce -l -50%LV /dev/vgdata/lvdata
[root@localhost~]# lvs
[root@localhost~]# mkfs.xfs /dev/vgdata/lvdata -f
[root@localhost~]# mount /dev/vgdata/lvdata /lvm_demo/
[root@localhost~]# df -h
[root@localhost~]# xfsrestore -f /root/lv_data_dump /lvm_demo/

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

20

LVM Disk Partition & XFS File System


Oracle Linux 7

(LVM Reduce on XFS File System, Dump XFS, Restore XFS)

linuxcoding

Copyright 2015 LinuxCoding.org and/its affiliates, All right reserved. |

21

linuxcoding
site : https://linuxcoding.org blog : http://blog.linuxcoding.org email : root@linuxcoding.org twitter : @HerwonoWr fb : Herwono W Wijaya fb group : Oracle Linux Indonesia

You might also like