1 |
Apparently, though unproven, at 23:01 on Friday 08 April 2011, Dale did opine |
2 |
thusly: |
3 |
|
4 |
> Dale wrote: |
5 |
> > root@fireball / # pvcreate /dev/sdb |
6 |
> > |
7 |
> > Physical volume "/dev/sdb" successfully created |
8 |
> > |
9 |
> > root@fireball / # |
10 |
> > |
11 |
> > Step one done. It didn't puke on my keyboard. lol |
12 |
> > |
13 |
> > Now to see what else I can get into. Not going to put anything |
14 |
> > important on it tho. Just a temporary thing right now. Just getting |
15 |
> > my feet wet. |
16 |
> > |
17 |
> > Dale |
18 |
> > |
19 |
> > :-) :-) |
20 |
> |
21 |
> More progress. |
22 |
> |
23 |
> root@fireball / # ls -al /dev/mapper/ |
24 |
> total 0 |
25 |
> drwxr-xr-x 2 root root 80 Apr 8 15:56 . |
26 |
> drwxr-xr-x 16 root root 4400 Apr 8 15:56 .. |
27 |
> crw-rw---- 1 root root 10, 236 Apr 8 04:39 control |
28 |
> lrwxrwxrwx 1 root root 7 Apr 8 15:56 sdb--vg-test -> ../dm-0 |
29 |
> root@fireball / # pvdisplay |
30 |
> --- Physical volume --- |
31 |
> PV Name /dev/sdb |
32 |
> VG Name sdb-vg |
33 |
> PV Size 232.83 GiB / not usable 2.58 MiB |
34 |
> Allocatable yes |
35 |
> PE Size 4.00 MiB |
36 |
> Total PE 59604 |
37 |
> Free PE 46804 |
38 |
> Allocated PE 12800 |
39 |
> PV UUID kopUKm-lXy1-7tiq-FuQ2-Xhs5-tGqN-Ls4R1v |
40 |
> |
41 |
> root@fireball / # vgdisplay |
42 |
> --- Volume group --- |
43 |
> VG Name sdb-vg |
44 |
> System ID |
45 |
> Format lvm2 |
46 |
> Metadata Areas 1 |
47 |
> Metadata Sequence No 2 |
48 |
> VG Access read/write |
49 |
> VG Status resizable |
50 |
> MAX LV 0 |
51 |
> Cur LV 1 |
52 |
> Open LV 0 |
53 |
> Max PV 0 |
54 |
> Cur PV 1 |
55 |
> Act PV 1 |
56 |
> VG Size 232.83 GiB |
57 |
> PE Size 4.00 MiB |
58 |
> Total PE 59604 |
59 |
> Alloc PE / Size 12800 / 50.00 GiB |
60 |
> Free PE / Size 46804 / 182.83 GiB |
61 |
> VG UUID 5OSiWZ-rWza-uKJ2-rVMO-f38G-NBHx-dmAE1K |
62 |
> |
63 |
> root@fireball / # lvdisplay |
64 |
> --- Logical volume --- |
65 |
> LV Name /dev/sdb-vg/test |
66 |
> VG Name sdb-vg |
67 |
> LV UUID mixhOb-La6D-BwG4-Uz3l-P0ci-oGg5-YI3mN8 |
68 |
> LV Write Access read/write |
69 |
> LV Status available |
70 |
> # open 0 |
71 |
> LV Size 50.00 GiB |
72 |
> Current LE 12800 |
73 |
> Segments 1 |
74 |
> Allocation inherit |
75 |
> Read ahead sectors auto |
76 |
> - currently set to 256 |
77 |
> Block device 254:0 |
78 |
> |
79 |
> root@fireball / # |
80 |
> |
81 |
> I'm still trying to figure out how the naming part works tho. Now to |
82 |
> mount it and put something on it. See if it works. |
83 |
|
84 |
Naming can vary a lot depending on udev rules. There will be one canonical |
85 |
name and one or more other things that symlink to it. |
86 |
|
87 |
Likely the canonical stuff will be /dev/mapper/..... |
88 |
and the symlinks will be in /dev/sdb-vg/..... |
89 |
cd and ls will see you right :-) |
90 |
|
91 |
|
92 |
|
93 |
> Let me know if something doesn't look right. Otherwise, I'll keep |
94 |
> playing around with it. |
95 |
|
96 |
Cool. So now you have a 250G PV, and it's the the only PV in it's volume |
97 |
group. You've made a 50G LV called "test" |
98 |
|
99 |
Cool so far. Now make a few more LVs (check the man pages, I'm doing this from |
100 |
memory): |
101 |
|
102 |
lvcreate -L 20G -n test2 sdb-vg |
103 |
lvcreate -L 30G -n test3 sdb-vg |
104 |
|
105 |
mkfs them: |
106 |
mkfs.<your_choice> /dev/sdb-vg/test{,2,3} |
107 |
|
108 |
mount points: |
109 |
mkdir /mnt/test{,2,3} |
110 |
|
111 |
mount them: |
112 |
mount /dev/sdb-vg/test /mnt/test |
113 |
|
114 |
Whoop-dee-doo. Now you can copy stuff there and do whatever you do with |
115 |
filesystems. Let's assume you have music on the first one "test". Let's also |
116 |
assume you get more music and it's more than 50G; say you need another 20. |
117 |
Easy-peasy, grow the filesystem, grow the LV: |
118 |
|
119 |
lvextend -L +20G /dev/sdb-vg/test |
120 |
resize2fs /dev/sdb-vg/test |
121 |
|
122 |
That's it. Nothing more. Without LVM, you'd be off down to the 'puter store |
123 |
looking to buy 70 CDs to do that :-) |
124 |
|
125 |
It's important to remember that once you've made /dev/sdb into a PV, you will |
126 |
never touch that device again. You will especially never fdisk or mkfs it - |
127 |
all that is done on the block device that LVM gives you - /dev/sdb-vg/test |
128 |
|
129 |
|
130 |
|
131 |
-- |
132 |
alan dot mckinnon at gmail dot com |