LVM in Linux – Logical volume manager

In this article i will explain write down some commands that i have used on Linux debian working with LVM, the purpose i have used LVM is to be able creating snapshots of my filesystem, this is very usefull espacily for development enviorment.

snapshots is supported by filesystem called xfs it have feature of freezing all write to the filesystem then you shall make the snapshot and when the snap is finished you unfreeze the filesystem.

pvscan – Use to get a list of all available physical drivers

 vgcreate test /dev/sdc1     -  create volume group

lvm> lvcreate -L 5G test             -    lvcreate Create a logical volume

Making fresh filesystem with xfs insted of ext3

linux-tac:/# mkfs.xfs /dev/test/lvol0
meta-data=/dev/test/lvol0 isize=256 agcount=4, agsize=327680 blks= sectsz=512 attr=2, rojid32bit=0 data = bsize=4096 blocks=1310720, imaxpct=25  = sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 log =internal log bsize=4096 blocks=2560, version=2= sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0

 After the filesystem has initilize i can start copy files to it,
Now before i want to make the snapshot i will freeze the filesystem

freeze write command to xfs filesystem

xfs_freeze /mnt

 Making a snapshot

lvcreate -l 500 -s -n snap /dev/test/lvol0

Mounting the snapshot to the system as readonly

mount -o nouuid,ro /dev/test/snap /snap1

Usefull links where i read the information:


כתיבת תגובה

צריך להכנס למערכת בשביל להשאיר תגובה.