Improve about page
Remove cache and compiled site
This commit is contained in:
parent
77d432ad8b
commit
03cf79e8f0
82 changed files with 321 additions and 1405 deletions
|
@ -0,0 +1,53 @@
|
|||
I"å<p>When I was scaling up my home lab, I started thinking more about data management.
|
||||
I hadn’t (and still haven’t) set up any form of network storage.
|
||||
I have, however, set up a backup mechanism using <a href="https://borgbackup.readthedocs.io/en/stable/">Borg</a>.
|
||||
Still, I want to operate lots of virtual machines, and backing up each one of them separately seemed excessive.
|
||||
So I started thinking, what if I just let the host machines back up the data?
|
||||
After all, the amount of physical hosts I have in my home lab is unlikely to increase drastically.</p>
|
||||
|
||||
<h1 id="the-use-case-for-sharing-directories">The Use Case for Sharing Directories</h1>
|
||||
|
||||
<p>I started working out this idea further.
|
||||
Without network storage, I needed a way for guest VMs to access the host’s disks.
|
||||
Here there are two possibilities, either expose some block device or a file system.
|
||||
Creating a whole virtual disk for just the data of some VMs seemed wasteful, and from my experiences also increases backup times dramatically.
|
||||
I therefore searched for a way to mount a directory from the host OS on the guest VM.
|
||||
This is when I stumbled upon <a href="https://rabexc.org/posts/p9-setup-in-libvirt">this blog</a> post talking about sharing directories with virtual machines.</p>
|
||||
|
||||
<h1 id="sharing-directories-with-virtio-9p">Sharing Directories with virtio-9p</h1>
|
||||
|
||||
<p>virtio-9p is a way to map a directory on the host OS to a special device on the virtual machine.
|
||||
In <code class="language-plaintext highlighter-rouge">virt-manager</code>, it looks like the following:
|
||||
<img src="virt-manager.png" alt="picture showing virt-manager configuration to map a directory to a VM" />
|
||||
Under the hood, virtio-9p uses the 9pnet protocol.
|
||||
Originally developed at Bell Labs, support for this is available in all modern Linux kernels.
|
||||
If you share a directory with a VM, you can then mount it.
|
||||
Below is an extract of my <code class="language-plaintext highlighter-rouge">/etc/fstab</code> to automatically mount the directory:</p>
|
||||
<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>data /mnt/data 9p trans=virtio,rw 0 0
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>The first argument (<code class="language-plaintext highlighter-rouge">data</code>) refers to the name you gave this share from the host
|
||||
With the <code class="language-plaintext highlighter-rouge">trans</code> option we specify that this is a virtio share.</p>
|
||||
|
||||
<h1 id="problems-with-virtio-9p">Problems with virtio-9p</h1>
|
||||
|
||||
<p>At first I had no problems with my setup, but I am now contemplating just moving to a network storage based setup because of two problems.</p>
|
||||
|
||||
<p>The first problem is that some files have suddenly changed ownership from <code class="language-plaintext highlighter-rouge">libvirt-qemu</code> to <code class="language-plaintext highlighter-rouge">root</code>.
|
||||
If the file is owned by <code class="language-plaintext highlighter-rouge">root</code>, the guest OS can still see it, but cannot access it.
|
||||
I am not entirely sure the problem lies with virtio, but I suspect it is.
|
||||
For anyone experiencing this problem, I wrote a small shell script to revert ownership to the <code class="language-plaintext highlighter-rouge">libvirt-qemu</code> user:</p>
|
||||
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>find <span class="nt">-printf</span> <span class="s2">"%h/%f %u</span><span class="se">\n</span><span class="s2">"</span> | <span class="nb">grep </span>root | <span class="nb">cut</span> <span class="nt">-d</span> <span class="s1">' '</span> <span class="nt">-f1</span> | xargs <span class="nb">chown </span>libvirt-qemu:libvirt-qemu
|
||||
</code></pre></div></div>
|
||||
|
||||
<p>Another problem that I have experienced, is guests being unable to mount the directory at all.
|
||||
I have only experienced this problem once, but it was highly annoying.
|
||||
To fix it, I had to reboot the whole physical machine.</p>
|
||||
|
||||
<h1 id="alternatives">Alternatives</h1>
|
||||
|
||||
<p>virtio-9p seemed like a good idea, but as discussed, I had some problems with it.
|
||||
It seems <a href="https://virtio-fs.gitlab.io/">virtioFS</a> might be a an interesting alternative as it is designed specifically for sharing directories with VMs.</p>
|
||||
|
||||
<p>As for me, I will probably finally look into deploying network storage either with NFS or SSHFS.</p>
|
||||
:ET
|
Loading…
Add table
Add a link
Reference in a new issue