author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 19 Oct 2015 17:04:52 +0300 | |
changeset 1769 | cadd23f8127f |
parent 899 | 7b4265c8d324 |
permissions | -rw-r--r-- |
899
7b4265c8d324
Set fill-column as directory local var.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
735
diff
changeset
|
1 |
-*- mode: outline; coding: utf-8; -*- |
0 | 2 |
|
3 |
* Debian package. |
|
4 |
||
204 | 5 |
$ sudo apt-get install lvm |
0 | 6 |
|
7 |
* See partitions. |
|
8 |
||
9 |
$ sudo sfdisk -l |
|
10 |
||
11 |
or use gparted(1). |
|
12 |
||
13 |
* Setup physical volume. |
|
14 |
||
15 |
$ sudo pvcreate /dev/sdc3 |
|
16 |
Physical volume "/dev/sdc3" successfully created |
|
17 |
||
18 |
* Setup volume group. |
|
19 |
||
20 |
$ sudo vgcreate vg0 /dev/sdc3 |
|
21 |
Volume group "vg0" successfully created |
|
22 |
||
21 | 23 |
* Show info about volume group. |
24 |
||
25 |
$ sudo vgdisplay |
|
0 | 26 |
--- Volume group --- |
27 |
VG Name vg0 |
|
21 | 28 |
System ID |
0 | 29 |
Format lvm2 |
30 |
Metadata Areas 1 |
|
31 |
Metadata Sequence No 1 |
|
32 |
VG Access read/write |
|
33 |
VG Status resizable |
|
34 |
MAX LV 0 |
|
35 |
Cur LV 0 |
|
36 |
Open LV 0 |
|
37 |
Max PV 0 |
|
38 |
Cur PV 1 |
|
39 |
Act PV 1 |
|
40 |
VG Size 77.22 GB |
|
41 |
PE Size 4.00 MB |
|
42 |
Total PE 19769 |
|
21 | 43 |
Alloc PE / Size 0 / 0 |
0 | 44 |
Free PE / Size 19769 / 77.22 GB |
45 |
VG UUID ZOQvrP-PnJ2-kKsH-7aLU-eOa3-K5M2-sRstJH |
|
46 |
||
47 |
||
48 |
* Create logical volume. |
|
49 |
||
50 |
$ sudo lvcreate -L 10G -n home vg0 |
|
51 |
Logical volume "home" created |
|
52 |
||
21 | 53 |
* Show info about logical volume. |
54 |
||
55 |
$ sudo lvdisplay |
|
56 |
--- Logical volume --- |
|
57 |
LV Name /dev/vg0/home |
|
58 |
VG Name vg0 |
|
59 |
LV UUID XWJFnF-LjQg-Xsvm-IeQI-68mX-jiYd-pSpA00 |
|
60 |
LV Write Access read/write |
|
61 |
LV Status available |
|
62 |
# open 1 |
|
63 |
LV Size 20.00 GB |
|
64 |
Current LE 5120 |
|
65 |
Segments 1 |
|
66 |
Allocation inherit |
|
67 |
Read ahead sectors 0 |
|
68 |
Block device 254:0 |
|
69 |
||
70 |
--- Logical volume --- |
|
71 |
LV Name /dev/vg0/swap |
|
72 |
VG Name vg0 |
|
73 |
LV UUID BHBQd0-1RlO-hHn7-jAij-Gyg6-KnqE-lRBgPY |
|
74 |
LV Write Access read/write |
|
75 |
LV Status available |
|
76 |
# open 1 |
|
77 |
LV Size 1.00 GB |
|
78 |
Current LE 256 |
|
79 |
Segments 1 |
|
80 |
Allocation inherit |
|
81 |
Read ahead sectors 0 |
|
82 |
Block device 254:1 |
|
83 |
||
0 | 84 |
* Create fs on logical volume. |
85 |
||
86 |
$ sudo mke2fs -j /dev/vg0/home |
|
87 |
mke2fs 1.40-WIP (14-Nov-2006) |
|
88 |
Filesystem label= |
|
89 |
OS type: Linux |
|
90 |
Block size=4096 (log=2) |
|
91 |
Fragment size=4096 (log=2) |
|
92 |
1310720 inodes, 2621440 blocks |
|
93 |
131072 blocks (5.00%) reserved for the super user |
|
94 |
First data block=0 |
|
95 |
Maximum filesystem blocks=2684354560 |
|
96 |
80 block groups |
|
97 |
32768 blocks per group, 32768 fragments per group |
|
98 |
16384 inodes per group |
|
99 |
Superblock backups stored on blocks: |
|
100 |
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 |
|
101 |
||
102 |
Writing inode tables: done |
|
103 |
Creating journal (32768 blocks): done |
|
104 |
Writing superblocks and filesystem accounting information: done |
|
105 |
||
106 |
* Remove logical volume. |
|
107 |
||
22 | 108 |
$ sudo lvremove /dev/vg0/home |
0 | 109 |
|
110 |
* Move home dir to lvm. |
|
111 |
||
112 |
$ su |
|
113 |
... |
|
114 |
$ mv /home /home2 |
|
115 |
$ lvcreate -L 10G -n home vg0 |
|
116 |
$ mke2fs -j /dev/vg0/home |
|
117 |
$ emacs /etc/fstab |
|
118 |
... |
|
119 |
$ cat /etc/fstab |
|
120 |
... |
|
121 |
/dev/vg0/home /home ext3 defaults 0 2 |
|
122 |
... |
|
123 |
$ mount -a |
|
124 |
$ (cd /home2; tar -cf - .) | (cd /home; tar -xpf -) |
|
125 |
$ rm -r /home2 |
|
126 |
||
127 |
* Creating swap on lvm. |
|
128 |
||
129 |
$ su |
|
130 |
... |
|
131 |
$ lvcreate -L 1G -n swap vg0 |
|
132 |
$ mkswap -v1 /dev/vg0/swap |
|
133 |
$ emacs /etc/fstab |
|
134 |
... |
|
135 |
$ cat /etc/fstab |
|
136 |
... |
|
137 |
/dev/vg0/swap swap swap defaults 0 0 |
|
138 |
... |
|
139 |
$ swapon -a |
|
140 |