[opensuse-buildservice] Confused about LVM and bootstrap process
Hi, I'm trying to setup a little toy OBS to learn how it works. I'm using KVM on Ubuntu 16.04, following the directions at http://openbuildservice.org/download/other/ A couple of things are unclear on that page: 1) exactly how to create the LVM volume group and logical volume, 2) whether the "OBS" VG is required or merely desirable, and 3) how to tell if OBS is using those LVM volumes. For #1, I google'd and read some blog posts and learned about creating a big empty file, running "losetup" on it, then using pvcreate, vgcreate, and lvcreate. Result: a 10 GB file on the host system, accessible via /dev/loop0, containing a single volume group called "OBS". 4 GB of that volume group is allocated to a logical volume called "server". The other 6 GB is unallocated. I can see these *on the host system* with vgdisplay and lvdisplay. (Yes, I know 10 GB is almost certainly not enough. This is a toy OBS, just for learning. Once I've successfully built a couple of packages, I'll probably throw it away.) Then, before booting the OBS VM for the first time, I attached /dev/loop0 to the VM as a second hard disk. And it seems to have worked! Once the VM is booted, vgdisplay and lvdisplay show me the LVS stuff I created on the host system: obstest:~ # vgdisplay --- Volume group --- VG Name OBS System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 10.00 GiB PE Size 4.00 MiB Total PE 2559 Alloc PE / Size 1024 / 4.00 GiB Free PE / Size 1535 / 6.00 GiB VG UUID 8L9QSW-lEnD-f1rN-Qbxc-yav7-U0Sv-EitQn5 obstest:~ # lvdisplay --- Logical volume --- LV Path /dev/OBS/server LV Name server VG Name OBS LV UUID g6N3zs-MbtP-nTZY-tK0V-EGvE-Vk3S-kEYrRb LV Write Access read/write LV Creation host, time queequeg, 2016-11-22 23:07:55 +0000 LV Status available # open 0 LV Size 4.00 GiB Current LE 1024 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 1024 Block device 254:0 So, I *believe* I have satisfied the LVS conditions explained on http://openbuildservice.org/download/other/. After running /usr/lib/obs/server/setup-appliance.sh, I was able to access the OBS web interface from my host system. Awesome! But there is no indication that OBS has done anything with my LVM setup. Was that all a waste of time? Or did I do something wrong? Thanks, Greg -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
On Donnerstag, 24. November 2016, 11:16:33 CET wrote Greg Ward:
Hi,
I'm trying to setup a little toy OBS to learn how it works. I'm using KVM on Ubuntu 16.04, following the directions at
http://openbuildservice.org/download/other/
A couple of things are unclear on that page: 1) exactly how to create the LVM volume group and logical volume, 2) whether the "OBS" VG is required or merely desirable, and 3) how to tell if OBS is using those LVM volumes.
For #1, I google'd and read some blog posts and learned about creating a big empty file, running "losetup" on it, then using pvcreate, vgcreate, and lvcreate. Result: a 10 GB file on the host system, accessible via /dev/loop0, containing a single volume group called "OBS". 4 GB of that volume group is allocated to a logical volume called "server". The other 6 GB is unallocated. I can see these *on the host system* with vgdisplay and lvdisplay.
(Yes, I know 10 GB is almost certainly not enough. This is a toy OBS, just for learning. Once I've successfully built a couple of packages, I'll probably throw it away.)
Then, before booting the OBS VM for the first time, I attached /dev/loop0 to the VM as a second hard disk.
And it seems to have worked! Once the VM is booted, vgdisplay and lvdisplay show me the LVS stuff I created on the host system:
obstest:~ # vgdisplay --- Volume group --- VG Name OBS System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 10.00 GiB PE Size 4.00 MiB Total PE 2559 Alloc PE / Size 1024 / 4.00 GiB Free PE / Size 1535 / 6.00 GiB VG UUID 8L9QSW-lEnD-f1rN-Qbxc-yav7-U0Sv-EitQn5
obstest:~ # lvdisplay --- Logical volume --- LV Path /dev/OBS/server LV Name server VG Name OBS LV UUID g6N3zs-MbtP-nTZY-tK0V-EGvE-Vk3S-kEYrRb LV Write Access read/write LV Creation host, time queequeg, 2016-11-22 23:07:55 +0000 LV Status available # open 0 LV Size 4.00 GiB Current LE 1024 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 1024 Block device 254:0
So, I *believe* I have satisfied the LVS conditions explained on http://openbuildservice.org/download/other/.
After running /usr/lib/obs/server/setup-appliance.sh, I was able to access the OBS web interface from my host system. Awesome! But there is no indication that OBS has done anything with my LVM setup. Was that all a waste of time? Or did I do something wrong?
/dev/OBS/server is used for the data storage of the server when you use the appliance setup. This should become visible, when you check your mount points on your system, it should be mounted to /srv/obs. This makes sense, because you can replace the entire appliance (the root file system) for example to update your server. Or to move it to some other location. The new appliance will check on boot, mount it at the same place and may run some updates (eg database migrations) and you won't loose any data. -- Adrian Schroeter email: adrian@suse.de SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) Maxfeldstraße 5 90409 Nürnberg Germany -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
Hi, On Do, 2016-11-24 at 11:16 -0500, Greg Ward wrote:
Hi,
I'm trying to setup a little toy OBS to learn how it works. I'm using KVM on Ubuntu 16.04, following the directions at
http://openbuildservice.org/download/other/
A couple of things are unclear on that page: 1) exactly how to create the LVM volume group and logical volume,
I think there are enough Howto`s out there to describe the lvm setup procedures.
2) whether the "OBS" VG is required or merely desirable, and
I have to admit that it would be a good idea to mention that LVM setup is optional
3) how to tell if OBS is using those LVM volumes.
all the magic happens in init script "obsstoragesetup". This script must be enabled and in /etc/sysconfig/obs-server OBS_STORAGE_AUTOSETUP="yes" must be set.
So, I *believe* I have satisfied the LVS conditions explained on http://openbuildservice.org/download/other/.
After running /usr/lib/obs/server/setup-appliance.sh, I was able to access the OBS web interface from my host system. Awesome! But there is no indication that OBS has done anything with my LVM setup.
if your lv /dev/OBS/server is mounted to /srv/obs (at least in default config) it should have worked. Anyway - for only playing around I would strongly recommend to use one of the appliances (qcow2 might be the best choice, because its the most commonly used and best tested). It`s also a good choice for productive use - but then I would recommend an extra virtual disk with the LVM setup and physical worker machines. cu Frank -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
[me]
http://openbuildservice.org/download/other/
A couple of things are unclear on that page: 1) exactly how to create the LVM volume group and logical volume,
[Frank Schreiner]:
I think there are enough Howto`s out there to describe the lvm setup procedures.
*If* it was clear that LVM is optional -- not necessary when playing around, but recommended for production setups -- yes, I would agree. But it would be nice to link to a good howto, and to mention something like "you need to attach the loopback device containing your 'OBS' volume group to the VM before booting it". (I'm just guessing here! That might not be an accurate statement.)
2) whether the "OBS" VG is required or merely desirable, and
I have to admit that it would be a good idea to mention that LVM setup is optional
It's not clear how to submit a patch to that web page. So here is a suggested rework of the "Appliance Configuration" section: Appliance Configuration On first boot the system adapts to the hardware and defaults to automatic IP and DNS configuration via DHCP. For an experimental/throwaway server, that should be enough. But if you run lots of builds, you'll quickly use up the disk space in that VM. Also, your data will be lost if you upgrade by replacing the VM image. A more robust approach is available: on your host system, create an LVM volume group named "OBS". Make sure this volume group is at least XX GB. You can create it either on real disks (e.g. /dev/sd??), or with loopback devices. Attach the device containing the "OBS" volume group to your VM before boot, and OBS will use the volume group for worker filesystems. Additionally, if this volume group contains a logical volume named "server", it will be used as the data partition for the server. To update your OBS server, you can use system tools (YaST or zypper). Or you can replace the entire image—although if you do that without the LVS setup, all your data will be lost.
3) how to tell if OBS is using those LVM volumes.
all the magic happens in init script "obsstoragesetup". This script must be enabled and in /etc/sysconfig/obs-server
OBS_STORAGE_AUTOSETUP="yes"
must be set.
Ah! Thank you, getting closer. I did not know about that config file, and I don't know which init scripts I'm supposed to enable/start manually and which are enabled out of the box for me. So, OBS_STORAGE_AUTOSETUP is already set for me: # grep STORAGE /etc/sysconfig/obs-server OBS_STORAGE_AUTOSETUP="yes" But the init script was not enabled. I did that and now I see this in the log (journalctl -u obsstoragesetup): Nov 23 01:01:45 obstest obsstoragesetup[7363]: ERROR: Not enough space for worker root LVs, just -12290 MB, but at least 4 GB needed. Ah-ha! Progress! Incidentally, my "OBS" volume group is 10 GiB, and the "server" logical volume is 4 GiB. I just picked those numbers out of thin air, since the docs gave me no guidance. I'll make the volume group bigger and see what happens. But it looks like there is a bug in the code that generates that error message. Thanks for the help, Greg -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
participants (3)
-
Adrian Schröter
-
Frank Schreiner
-
Greg Ward