Trying Plan9's 9P Protocol with diod

5 min

language: ja bn en es hi pt ru zh-cn zh-tw

Hello, I'm Munou.

This time, I will try the Plan9 protocol, which was developed by Plan9 at Bell Labs, where UNIX was born, for distributed operating systems.

Introduction

As a distributed OS, Plan9 was configured more simply by treating all resources as files.
For this reason, it seems that CPU resources were also distributed by accessing resources remotely on their respective file systems. For example, you can concatenate /bin directories, or share devices without adding code if it's /dev.
For instance, even now, with cups (Common Unix Printing System), you can easily print from a print server by simply sharing /var/spool/cups, which points to the queue directory.
It should be easier to operate by mounting it on the file system rather than managing it by port.

I will try the Plan9 Protocol that was used in that context.
In reality, currently, if you check Wikipedia, there are qemu and diod available for BSD and GNU/Linux. Since I'm already using qemu, this time I'll try diod, which is a more traditional UNIX-like file server for it.

Installing diod

diod's Github is here, but it can be easily installed via package management.
apt

sudo apt isntall diod  

yay

yay -S diod  

This completes the installation.

Starting the server, mounting

The method is described in the README.md on Github, so I will follow it.
This time, I will mount the server's /media/ncp/files directory to the client's /mnt/9p.

Also, since it operates on 564/TCP, I will allow it from the server using ufw. Server

sudo ufw allow 564/tcp  
sudo ufw reload  
sudo diod -f -d 1 -n -e /media/ncp/files/  

The server has now started.

Client

sudo diodmount -n 192.168.10.113:/media/ncp/files /mnt/9p  

The mount is now complete.
Let's check with ls.

$ ls -la /mnt/9p/  
合計 6115604  
drwxr-xr-x 2 haturatu haturatu       4096  9月  2 21:58 .  
drwxr-xr-x 3 root     root           4096  9月  5 22:32 ..  
-rw-r--r-- 1 haturatu haturatu 6262358016  9月  2 13:58 devuan.qcow2  
-rwxr-xr-x 1 root     root           1845  9月  2 21:58 index.php  
-rw-r--r-- 1 root     root            937  9月  2 21:53 style.css  

Perfect. Later, I'll have to change the user here to www-data...

Unmounting is fine as usual.

sudo umount /mnt/9p  

Simpler

It's very comfortable because it eliminates complexity and is simple.
Originally, it was a system for distributed OS, but unfortunately, BSD and GNU/Linux have become common and have different file systems.
Due to this divergence, making it a distributed OS across different OSes doesn't seem very realistic.
For example, for FreeBSD, pkg and user-installed software groups use configuration files in /usr/loacl/etc, while GNU/Linux uses /etc.
Also, FreeBSD does not have /proc and /sys, but GNU/Linux does.
Of course, there are some reciprocal parts, so it can be said that it's possible in some cases.

In this case, if you combine it with Wireguard from a small-storage VPS, you can easily expand storage, and it has a fair amount of practicality.
Also, speaking of other file servers, I've used several like Samba, but I feel this is probably the simplest and fastest.

To digress a bit, re-reading Theo de Raadt's interview article about OpenBSD, and re-reading OpenBSD's Wikipedia page,

Emphasis on open source and documentation

it states, and the fact that I could easily test even such an old system is thanks to those who created the documentation in the past.
It was a day where I once again felt the importance of documentation, prioritizing simplicity over complexity.

That's all for now. See you next time.

Related Posts