From 68834c562daf06b8625eea5c5b18430f594cea17 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Thu, 29 Sep 2016 05:54:56 +0100 Subject: tools storage and lvm revision --- tools/lvm.html | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 tools/lvm.html (limited to 'tools/lvm.html') diff --git a/tools/lvm.html b/tools/lvm.html new file mode 100644 index 0000000..8b1624a --- /dev/null +++ b/tools/lvm.html @@ -0,0 +1,151 @@ + + + + + LVM + + + + Tools Index + +

LVM

+ +

Read Raid Setup, + the only thing you will need outside system is: + "Patience, Pizza, and your favorite caffeinated beverage.". + Arch Wiki + article about Sofware RAID and LVM.

+ +

Basic idea behind RAID is to deal with independent disks + as an array of drives. Raid 0 uses two or more disks as one, + with performance gains without fault-tolerance. From raid 1 + to 6 they offer diferent fault tolerance mechanisms.

+ +

LVM or Logic Volume Manager bring one more layer, read + Lvm made easy. + Partitions under lvm are easy to be resized, moved and there is + a tool to help encrypt. There is more freedom to name physical + disk names exp; production, development, backups...

+ + +

Until now "from install" there is only one partition, + it is good idea to have a system with diferent partitions for each + propos. If is a "fresh install";

+ +
+        # cd /iso/crux/opt/
+        # pkgadd lvm2#2.02.107-1.pkg.tar.xz
+        #
+        
+ +

1. LVM Partition

+ +

Create a LVM partition, fdisk should + show something like this;

+ +
+        # parted /dev/sda
+        
+ +

I use defaults unless to define system partition last sector, + where in this example is size, +80G

+ + +

2. Create physical volume

+ +
+         # pvcreate /dev/sdb3
+          Physical volume "/dev/sdb3" successfully created
+        
+ +

3. Create volume group

+ +
+        # vgcreate vg_system /dev/sdb3
+          Volume group "vg_system" successfully created
+        # vgcreate homevg /dev/sdb4
+          Volume group "homevg" successfully created
+        #
+        
+ +

3.1. Search Volume Groups

+ +
+        # vgscan
+          Reading all physical volumes.  This may take a while...
+          Found volume group "homevg" using metadata type lvm2
+          Found volume group "vg_system" using metadata type lvm2
+        #
+        
+ +

4. Create logical volume

+ +
+        # lvcreate -L 15G -n distfileslv vg_system
+          Logical volume "distfileslv" created.
+        # lvcreate -L 8G -n packageslv vg_system
+          Logical volume "packageslv" created.
+        # lvcreate -L 4G -n swaplv vg_system
+          Logical volume "swaplv" created.
+        # lvcreate -L 80G -n homelv homevg
+          Logical volume "homelv" created.
+        #
+        
+ +
+        # mkfs.ext4 /dev/vg_system/distfileslv
+        # mkfs.ext4 /dev/vg_system/packageslv
+        # mkswap /dev/vg_system/swaplv
+        # mkfs.ext4 /dev/homevg/homelv
+        
+ +

4.1. Activate Deactivate

+ +

Deactivate logical volumes;

+ +
+        # lvchange -a -n /dev/vg_system/packageslv
+        # lvchange -a -n /dev/vg_system/distfileslv
+        # swapoff /dev/vg_system/sawplv
+        # lvchange -a -n /dev/vg_system/swaplv
+        
+ +

Deactivate volume group;

+ +
+         # vgchange -a n vg_system
+         0 logical volume(s) in volume group "vg_system" now active
+         #
+        
+ +

Activate volume group;

+
+        # vgchange -a y vg_system
+          3 logical volume(s) in volume group "vg_system" now active
+        #
+        
+ +

5. Maintenance

+ +
+        # smartctl -t long /dev/sdb1
+        # smartctl -a /dev/sdb1 | less
+        
+ +

Non Destructive Test;

+ +
+        # badblocks -nsv /dev/sdb1
+        
+ +

7. Encryption

+ + Tools Index +

+ This is part of the c9-doc Manual. + Copyright (C) 2016 + c9 team. + See the file Gnu Free Documentation License + for copying conditions.

+ + -- cgit 1.4.1-2-gfad0