Difference between revisions of "Building a Storage Server"
(Created page with "{{{!}} class="wikitable" style="float: right; width: 322px;" border="2" {{!}}+ Proven on: {{!}}- --="" debian="" {{!}} style="text-align: center; width: 60px;" {{!}} [[File:Logo Debian.png{{!}}60px{{!}}link=https://www.debian.org/{{!}}center{{!}}middle{{!}}frameless]] {{!}} style="text-align: center; width: 40px;" {{!}} 12 (bookworm) {{!}} <br> {{!}}} We will be creating our storage server as an LXC under Proxmox with dedicated physical drives on the physical server....") |
|||
(22 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
{{!}} style="text-align: center; width: 60px;" {{!}} [[File:Logo Debian.png{{!}}60px{{!}}link=https://www.debian.org/{{!}}center{{!}}middle{{!}}frameless]] | {{!}} style="text-align: center; width: 60px;" {{!}} [[File:Logo Debian.png{{!}}60px{{!}}link=https://www.debian.org/{{!}}center{{!}}middle{{!}}frameless]] | ||
{{!}} style="text-align: center; width: 40px;" {{!}} 12 (bookworm) | {{!}} style="text-align: center; width: 40px;" {{!}} 12 (bookworm) | ||
{{!}} | {{!}} Developed as a LXC | ||
<br> | <br> | ||
{{!}}} | {{!}}} | ||
We will be creating our storage server as an LXC under Proxmox with dedicated physical drives on the physical server. | We will be creating our storage server as an [[PVE LXC Containers|LXC]] under [[Proxmox Stuff|Proxmox]] with dedicated physical drives on the physical server. | ||
With a bit of thought, you'll note that most of these instructions apply just as well without the dedicated drive(s) involved. | |||
(NOTE: any file/folder names in '''''bold & italic''''' here are examples of what I'm doing on a local system & may be different depending on YOUR needs...) | (NOTE: any file/folder names in '''''bold & italic''''' here are examples of what I'm doing on a local system & may be different depending on YOUR needs...) | ||
Line 20: | Line 22: | ||
Under '''Options / Features''', turn on '''Nesting''', '''NFS''' & '''SMB/CIFS.''' | Under '''Options / Features''', turn on '''Nesting''', '''NFS''' & '''SMB/CIFS.''' | ||
It will simply your life if you can set up local users matching each network user that will be accessing this server. On my network, there are only 3 users that match this criteria. But, you may want to look into kerberos or some such. | It will simply your life if you can set up local users matching each network user that will be accessing this server. On my network, there are only 3 users that match this criteria. But, you may want to look into [https://en.wikipedia.org/wiki/Kerberos_(protocol) kerberos] or some such. | ||
=== Setting up dedicated drives === | === Setting up dedicated drives === | ||
See: [[Adding a new drive from the command line]] | |||
Personally, I like to handle my drives '''by label''' to make them easier to find & move around if needed. | |||
In this case, I'm adding 5 drives to the LXC... | |||
This section is to be done while logged into the Proxmox server as '''root'''. | |||
* Create the starting points | Mount your dedicated drives on the Physical server itself. To do this at the command line: | ||
* <code>mount -L '''''Storage-0 /mnt/Storage-0'''''</code> | |||
* <code>mount -L '''''Storage-1 /mnt/Storage-1'''''</code> | |||
* <code>mount -L '''''Storage-2 /mnt/Storage-2'''''</code> | |||
* <code>mount -L '''''Storage-3 /mnt/Storage-3'''''</code> | |||
* <code>mount -L '''''Storage-4 /mnt/Storage-4'''''</code> | |||
Of course, you'll need to make these mounts persistent | |||
* <code>sudo vi /etc/fstab</code> | |||
LABEL='''''Storage-0''''' /mnt/'''''Storage-0''''' ext4 defaults 0 0 | |||
LABEL='''''Storage-1''''' /mnt/'''''Storage-1''''' ext4 defaults 0 0 | |||
LABEL='''''Storage-2''''' /mnt/'''''Storage-2''''' ext4 defaults 0 0 | |||
LABEL='''''Storage-3''''' /mnt/'''''Storage-3''''' ext4 defaults 0 0 | |||
LABEL='''''Storage-4''''' /mnt/'''''Storage-4''''' ext4 defaults 0 0 | |||
Then you can use [https://pve.proxmox.com/wiki/Linux_Container#_bind_mount_points bindmount] to attach them to your LXC. | |||
* <code>pct set '''''10020''''' -mp0 /mnt/Storage-0,mp=/mnt/Storage-0</code> | |||
* <code>pct set '''''10020''''' -mp1 /mnt/Storage-1,mp=/mnt/Storage-1</code> | |||
* <code>pct set '''''10020''''' -mp2 /mnt/Storage-2,mp=/mnt/Storage-2</code> | |||
* <code>pct set '''''10020''''' -mp3 /mnt/Storage-3,mp=/mnt/Storage-3</code> | |||
* <code>pct set '''''10020''''' -mp4 /mnt/Storage-4,mp=/mnt/Storage-4</code> | |||
At this point, I would recomment rebooting the LXC, either through the GUI or: | |||
* <code>pct reboot '''''10020'''''</code> | |||
=== The shares === | |||
The actual share setup is a fairly subjective & complex subject. It will vary a fair bit depending on your circumstances & needs. I'll be writing up as generic a layout as I can, but you may wish to expand on it. | |||
This storage server will be setup to make available the following tree of shares: | |||
* Backups | |||
** Backups/'''''Machine1''''' | |||
** Backups/'''''Machine2''''' | |||
** Backups/'''''Machine3''''' | |||
* Media | |||
** Media/'''''Music''''' | |||
** Media/'''''Movies''''' | |||
** Media/'''''Photos''''' | |||
* Documents | |||
** Documents/'''''User1''''' | |||
** Documents/'''''User2''''' | |||
** Documents/'''''User3''''' | |||
** Documents/'''''Shared''''' | |||
=== Prepping the shares === | |||
This section is to be done while logged into the LXC. | |||
Create the starting points | |||
(All of these '''bind mounts''' are done to manage how the shares appear to client machines and help separate things from their physical drive descriptions.) | |||
* <code>sudo mkdir /Backups</code> | |||
* <code>sudo mkdir /Media</code> | |||
* <code>sudo mkdir /Documents</code> | |||
Create the folders to be shared (I've created subfolders on the drive(s) through the usual methods...) | |||
* <code>sudo mkdir /Backups/'''''Cecil'''''</code> | |||
** <code>sudo mount -o bind /mnt/Storage-3/'''''Cecil-Backup'''''/ /Backups/'''''Cecil'''''</code> | ** <code>sudo mount -o bind /mnt/Storage-3/'''''Cecil-Backup'''''/ /Backups/'''''Cecil'''''</code> | ||
** <code>sudo mount -o bind /mnt/Storage-3/''''' | * <code>sudo mkdir /Media/'''''Photos''''' /Media/'''''Music''''' /Media/'''''Movies'''''</code> | ||
** etc, etc, etc... | ** <code>sudo mount -o bind /mnt/Storage-3/'''''Photos''''' /Media/'''''Photos'''''</code> | ||
** <code>sudo mount -o bind /mnt/Storage-4/'''''Music''''' /Media/'''''Music'''''</code> | |||
** <code>sudo mount -o bind /mnt/Storage-4/'''''Movies''''' /Media/'''''Movies'''''</code> | |||
* <code>sudo mkdir /Documents/'''''tinker'''''</code> | |||
** <code>sudo mount -o bind /mnt/Storage-2/'''''tinker''''' /Documents/'''''tinker'''''</code> | |||
* etc, etc, etc... | |||
Of course, you'll need to make these mounts persistent | |||
== NFS == | * <code>sudo vi /etc/fstab</code> | ||
<code>/mnt/Storage-3/'''''Cecil-Backup'''''/ /Backups/'''''Cecil''''' none defaults,bind 0 0</code> | |||
<code>/mnt/Storage-3/'''''Photos''''' /Media/'''''Photos''''' none defaults,bind 0 0</code> | |||
<code>/mnt/Storage-4/'''''Music''''' /Media/'''''Music''''' none defaults,bind 0 0</code> | |||
<code>/mnt/Storage-4/'''''Movies''''' /Media/'''''Movies''''' none defaults,bind 0 0</code> | |||
<code>/mnt/Storage-2/'''''tinker''''' /Documents/'''''tinker''''' none defaults,bind 0 0</code> | |||
* <code>sudo systemctl daemon-reload</code> | |||
* <code>sudo mount -a</code> | |||
== NFS (Network File System) == | |||
See: [[Setting up NFS for file sharing]] | See: [[Setting up NFS for file sharing]] | ||
=== Configuring the NFS shares === | === Configuring the NFS shares === | ||
== SMB == | * <code>sudo vi /etc/exports</code> | ||
<u>...WIP...</u> | |||
* <code>sudo exportfs -a</code> | |||
* <code>sudo /etc/init.d/nfs-kernel-server restart</code> | |||
== SMB (Server Message Block (Windows file sharing...)) == | |||
See: [[Installing Samba from the command line]] | See: [[Installing Samba from the command line]] | ||
=== Set up Samba Users === | |||
(Because Samba STILL can't just use the authentication built into the system... :| ) | |||
* <code>sudo smbpasswd -a '''''USER'''''</code> | |||
* repeat... | |||
=== Configuring the SMB shares === | === Configuring the SMB shares === | ||
== FTP == | * <code>sudo vi /etc/samba/smb.conf</code> | ||
<u>...WIP...</u> | |||
* <code>sudo systemctl restart smbd</code> | |||
== FTP (File Transfer Protocol) == | |||
See: [[FTP Serving]] | See: [[FTP Serving]] | ||
=== Configuring the FTP shares === | === Configuring the FTP shares === | ||
<u>...WIP...</u> | |||
* <code>sudo service proftpd restart</code> | |||
== tFTP (TRIVIAL File Transfer Protocol) == | |||
See: [[tFTP Serving]] | |||
=== Configuring the tFTP shares === | |||
<u>...WIP...</u> | |||
* <code>sudo systemctl restart tftpd-hpa.service</code> | |||
== RSYNC as a daemon == | |||
<u>...WIP...</u> | |||
From the rsync man page: | |||
<pre> | |||
STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS | |||
In order to connect to an rsync daemon, the remote system needs to have a daemon already running (or | |||
it needs to have configured something like inetd to spawn an rsync daemon for incoming connections | |||
on a particular port). For full information on how to start a daemon that will handling incoming | |||
socket connections, see the rsyncd.conf(5) man page -- that is the config file for the daemon, and | |||
it contains the full details for how to run the daemon (including stand-alone and inetd configura‐ | |||
tions). | |||
If you're using one of the remote-shell transports for the transfer, there is no need to manually | |||
start an rsync daemon. | |||
</pre> |
Latest revision as of 13:25, 21 September 2024
12 (bookworm) | Developed as a LXC
|
We will be creating our storage server as an LXC under Proxmox with dedicated physical drives on the physical server.
With a bit of thought, you'll note that most of these instructions apply just as well without the dedicated drive(s) involved.
(NOTE: any file/folder names in bold & italic here are examples of what I'm doing on a local system & may be different depending on YOUR needs...)
Building the LXC under Proxmox
Configuring the LXC
Configure this as a Privileged container.
Under Options / Features, turn on Nesting, NFS & SMB/CIFS.
It will simply your life if you can set up local users matching each network user that will be accessing this server. On my network, there are only 3 users that match this criteria. But, you may want to look into kerberos or some such.
Setting up dedicated drives
See: Adding a new drive from the command line
Personally, I like to handle my drives by label to make them easier to find & move around if needed.
In this case, I'm adding 5 drives to the LXC...
This section is to be done while logged into the Proxmox server as root.
Mount your dedicated drives on the Physical server itself. To do this at the command line:
mount -L Storage-0 /mnt/Storage-0
mount -L Storage-1 /mnt/Storage-1
mount -L Storage-2 /mnt/Storage-2
mount -L Storage-3 /mnt/Storage-3
mount -L Storage-4 /mnt/Storage-4
Of course, you'll need to make these mounts persistent
sudo vi /etc/fstab
LABEL=Storage-0 /mnt/Storage-0 ext4 defaults 0 0 LABEL=Storage-1 /mnt/Storage-1 ext4 defaults 0 0 LABEL=Storage-2 /mnt/Storage-2 ext4 defaults 0 0 LABEL=Storage-3 /mnt/Storage-3 ext4 defaults 0 0 LABEL=Storage-4 /mnt/Storage-4 ext4 defaults 0 0
Then you can use bindmount to attach them to your LXC.
pct set 10020 -mp0 /mnt/Storage-0,mp=/mnt/Storage-0
pct set 10020 -mp1 /mnt/Storage-1,mp=/mnt/Storage-1
pct set 10020 -mp2 /mnt/Storage-2,mp=/mnt/Storage-2
pct set 10020 -mp3 /mnt/Storage-3,mp=/mnt/Storage-3
pct set 10020 -mp4 /mnt/Storage-4,mp=/mnt/Storage-4
At this point, I would recomment rebooting the LXC, either through the GUI or:
pct reboot 10020
The actual share setup is a fairly subjective & complex subject. It will vary a fair bit depending on your circumstances & needs. I'll be writing up as generic a layout as I can, but you may wish to expand on it.
This storage server will be setup to make available the following tree of shares:
- Backups
- Backups/Machine1
- Backups/Machine2
- Backups/Machine3
- Media
- Media/Music
- Media/Movies
- Media/Photos
- Documents
- Documents/User1
- Documents/User2
- Documents/User3
- Documents/Shared
This section is to be done while logged into the LXC.
Create the starting points
(All of these bind mounts are done to manage how the shares appear to client machines and help separate things from their physical drive descriptions.)
sudo mkdir /Backups
sudo mkdir /Media
sudo mkdir /Documents
Create the folders to be shared (I've created subfolders on the drive(s) through the usual methods...)
sudo mkdir /Backups/Cecil
sudo mount -o bind /mnt/Storage-3/Cecil-Backup/ /Backups/Cecil
sudo mkdir /Media/Photos /Media/Music /Media/Movies
sudo mount -o bind /mnt/Storage-3/Photos /Media/Photos
sudo mount -o bind /mnt/Storage-4/Music /Media/Music
sudo mount -o bind /mnt/Storage-4/Movies /Media/Movies
sudo mkdir /Documents/tinker
sudo mount -o bind /mnt/Storage-2/tinker /Documents/tinker
- etc, etc, etc...
Of course, you'll need to make these mounts persistent
sudo vi /etc/fstab
/mnt/Storage-3/Cecil-Backup/ /Backups/Cecil none defaults,bind 0 0
/mnt/Storage-3/Photos /Media/Photos none defaults,bind 0 0
/mnt/Storage-4/Music /Media/Music none defaults,bind 0 0
/mnt/Storage-4/Movies /Media/Movies none defaults,bind 0 0
/mnt/Storage-2/tinker /Documents/tinker none defaults,bind 0 0
sudo systemctl daemon-reload
sudo mount -a
NFS (Network File System)
See: Setting up NFS for file sharing
sudo vi /etc/exports
...WIP...
sudo exportfs -a
sudo /etc/init.d/nfs-kernel-server restart
SMB (Server Message Block (Windows file sharing...))
See: Installing Samba from the command line
Set up Samba Users
(Because Samba STILL can't just use the authentication built into the system... :| )
sudo smbpasswd -a USER
- repeat...
sudo vi /etc/samba/smb.conf
...WIP...
sudo systemctl restart smbd
FTP (File Transfer Protocol)
See: FTP Serving
...WIP...
sudo service proftpd restart
tFTP (TRIVIAL File Transfer Protocol)
See: tFTP Serving
...WIP...
sudo systemctl restart tftpd-hpa.service
RSYNC as a daemon
...WIP...
From the rsync man page:
STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS In order to connect to an rsync daemon, the remote system needs to have a daemon already running (or it needs to have configured something like inetd to spawn an rsync daemon for incoming connections on a particular port). For full information on how to start a daemon that will handling incoming socket connections, see the rsyncd.conf(5) man page -- that is the config file for the daemon, and it contains the full details for how to run the daemon (including stand-alone and inetd configura‐ tions). If you're using one of the remote-shell transports for the transfer, there is no need to manually start an rsync daemon.