blob: 4c1b7299b122d5ae9649d6a9f3473f145fe029c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
<!-- TaskSplitZFSMirror, Version: 12, Modified: 2019/04/06, Author: feurig -->
#Task: Split ZF Mirror
We need to reduce the size of the zfs pool on the two 600G disks on bs2020 and use the space for backups. To do this we need to split the mirror and use the freed disk to create a new partition. Move that into place and then move the old data onto the smaller partition before finally repartitioning the remaining disk and mirror both new partitions.
Move running containers to kb2018
Get existing disk info.
```sh
root@bs2020:~# zpool status -L devel
pool: devel
state: ONLINE
scan: resilvered 132G in 2h2m with 0 errors on Thu Apr 4 00:31:41 2019
config:
NAME STATE READ WRITE CKSUM
devel ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
sdc ONLINE 0 0 0
sdd ONLINE 0 0 0
errors: No known data errors
root@bs2020:~# zpool status devel
pool: devel
state: ONLINE
scan: resilvered 132G in 2h2m with 0 errors on Thu Apr 4 00:41:41 2019
config:
NAME STATE READ WRITE CKSUM
devel ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
scsi-350000c0f022fd4c8 ONLINE 0 0 0
scsi-35000c50047d0926f ONLINE 0 0 0
```
errors: No known data errors
Split devel mirror.
```sh
root@bs2020:~# zpool split -R /newdevel devel newdevel
root@bs2020:~# zpool status
pool: devel
state: ONLINE
scan: scrub repaired 0B in 0h38m with 0 errors on Sun Mar 10 01:02:05 2019
config:
NAME STATE READ WRITE CKSUM
devel ONLINE 0 0 0
scsi-35000c50047d0926f ONLINE 0 0 0
errors: No known data errors
pool: infra
state: ONLINE
scan: scrub repaired 0B in 0h1m with 0 errors on Sun Mar 10 00:25:17 2019
config:
NAME STATE READ WRITE CKSUM
infra ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
scsi-35000cca00b33a264 ONLINE 0 0 0
scsi-350000395a8336d34 ONLINE 0 0 0
errors: No known data errors
pool: newdevel
state: ONLINE
scan: scrub repaired 0B in 0h38m with 0 errors on Sun Mar 10 01:02:05 2019
config:
NAME STATE READ WRITE CKSUM
newdevel ONLINE 0 0 0
scsi-350000c0f022fd4c8 ONLINE 0 0 0
```
Wipe and partition newly freed disk
```sh
root@bs2020:~# zpool destroy newdevel
root@bs2020:~# parted /dev/sdc
GNU Parted 3.2
Using /dev/sdc
(parted) mklabel gpt
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) mkpart
Partition name? []? images
File system type? [ext2]? zfs
Start? 0%
End? 50%
(parted) mkpart
Partition name? []? devel
File system type? [ext2]? zfs
Start? 50%
End? 100%
(parted) print
Model: WD WD6001BKHG (scsi)
Disk /dev/sdc: 600GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 300GB 300GB zfs images
2 300GB 600GB 300GB zfs devel
(parted) quit
```
Build new zfs partition for /var/lib/lxd/images and move the old data
```sh
root@bs2020:~# systemctl stop lxd
root@bs2020:~# zpool create lxd-images scsi-350000c0f022fd4c8-part1 -m/var/lib/lxd/images
root@bs2020:~# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
udev 49458232 0 49458232 0% /dev
tmpfs 9897784 1488 9896296 1% /run
/dev/sdg2 138930656 63784172 68019548 49% /
tmpfs 49488916 0 49488916 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 49488916 0 49488916 0% /sys/fs/cgroup
/dev/loop0 53376 53376 0 100% /snap/lxd/10234
/dev/loop1 91392 91392 0 100% /snap/core/6673
/dev/loop2 55168 55168 0 100% /snap/lxd/10343
/dev/loop3 93312 93312 0 100% /snap/core/6531
/dev/loop4 53376 53376 0 100% /snap/lxd/10289
/dev/loop5 93184 93184 0 100% /snap/core/6405
/dev/sdg1 523248 6164 517084 2% /boot/efi
/dev/sda1 480589544 47764176 408389708 11% /archive
tmpfs 9897780 0 9897780 0% /run/user/1000
lxd-images 282394496 0 282394496 0% /var/lib/lxd/images
root@bs2020:~# mv /var/lib/lxd/images.tmp/* /var/lib/lxd/images/
df -k
root@bs2020:~# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
udev 49458232 0 49458232 0% /dev
tmpfs 9897784 1496 9896288 1% /run
/dev/sdg2 138930656 15992764 115810956 13% /
tmpfs 49488916 0 49488916 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 49488916 0 49488916 0% /sys/fs/cgroup
/dev/loop0 53376 53376 0 100% /snap/lxd/10234
/dev/loop1 91392 91392 0 100% /snap/core/6673
/dev/loop2 55168 55168 0 100% /snap/lxd/10343
/dev/loop3 93312 93312 0 100% /snap/core/6531
/dev/loop4 53376 53376 0 100% /snap/lxd/10289
/dev/loop5 93184 93184 0 100% /snap/core/6405
/dev/sdg1 523248 6164 517084 2% /boot/efi
/dev/sda1 480589544 47764176 408389708 11% /archive
tmpfs 9897780 0 9897780 0% /run/user/1000
lxd-images 282392832 47751552 234641280 17% /var/lib/lxd/images
root@bs2020:~# systemctl start lxd
```
Build new devel pool on second partition and move data to smaller partition..
```sh
root@bs2020:~# zpool create devels scsi-350000c0f022fd4c8-part2
root@bs2020:~# zfs snapshot -r devel@fullbackup
root@bs2020:~# zfs send -R devel@fullbackup | pv | zfs receive -vFdu devels
....
```
Offline old devel pool replace with new
```sh
root@bs2020:~# systemctl stop lxd
root@bs2020:~# zpool export devels
root@bs2020:~# zpool destroy devel
root@bs2020:~# zpool import devels devel
root@bs2020:~# zpool status
pool: devel
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
devel ONLINE 0 0 0
scsi-350000c0f022fd4c8-part2 ONLINE 0 0 0
errors: No known data errors
...
root@bs2020:~# systemctl start lxd
```
Repartition remaining disk.
```sh
root@bs2020:~# parted /dev/sdd
GNU Parted 3.2
Using /dev/sdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: SEAGATE ST9600205SS (scsi)
Disk /dev/sdd: 600GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 600GB 600GB zfs zfs-f77cf42a401f4fa0
9 600GB 600GB 8389kB
(parted) mklabel
New disk label type? gpt
Warning: The existing disk label on /dev/sdd will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) mkpart
Partition name? []? images
File system type? [ext2]? zfs
Start? 0%
End? 50%
(parted) mkpart
Partition name? []? devel
File system type? [ext2]? zfs
Start? 50%
End? 100%
(parted) print
Model: SEAGATE ST9600205SS (scsi)
Disk /dev/sdd: 600GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 300GB 300GB zfs images
2 300GB 600GB 300GB zfs devel
(parted) quit
Information: You may need to update /etc/fstab.
```
Add new partitions as mirrors
```sh
root@bs2020:~# zpool attach lxd-images scsi-350000c0f022fd4c8-part1 scsi-35000c50047d0926f-part1
root@bs2020:~# zpool attach devel scsi-350000c0f022fd4c8-part2 scsi-35000c50047d0926f-part2
root@bs2020:~# zpool status
pool: devel
state: ONLINE
status: One or more devices is currently being resilvered. The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scan: resilver in progress since Fri Apr 5 22:39:37 2019
50.0M scanned out of 132G at 2.94M/s, 12h42m to go
48.6M resilvered, 0.04% done
config:
NAME STATE READ WRITE CKSUM
devel ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
scsi-350000c0f022fd4c8-part2 ONLINE 0 0 0
scsi-35000c50047d0926f-part2 ONLINE 0 0 0 (resilvering)
errors: No known data errors
pool: infra
state: ONLINE
scan: scrub repaired 0B in 0h1m with 0 errors on Sun Mar 10 00:25:17 2019
config:
NAME STATE READ WRITE CKSUM
infra ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
scsi-35000cca00b33a264 ONLINE 0 0 0
scsi-350000395a8336d34 ONLINE 0 0 0
errors: No known data errors
pool: lxd-images
state: ONLINE
status: One or more devices is currently being resilvered. The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scan: resilver in progress since Fri Apr 5 22:39:09 2019
3.70G scanned out of 45.6G at 84.2M/s, 0h8m to go
3.70G resilvered, 8.11% done
config:
NAME STATE READ WRITE CKSUM
lxd-images ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
scsi-350000c0f022fd4c8-part1 ONLINE 0 0 0
scsi-35000c50047d0926f-part1 ONLINE 0 0 0 (resilvering)
errors: No known data errors
root@bs2020:~#
```
Move containers back to bs2020
Continue work on backup scripts.
## References
https://github.com/lxc/lxd/issues/4984
|