Linux Server Storage

From Irregularpedia
Revision as of 05:34, 7 September 2024 by Maintenance script (talk | contribs) (Initial)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Persistence Mounted Storage

<syntaxhighlight lang="shell">lsblk #determine which drive has the size you attached echo "Which is the mounted Storage? (Look at the Storage Size) such as sda sdb sdc: " read DRIVE mkdir -p $HOME/datadrive #make a directory in the home user directory sudo mkfs.ext4 /dev/$DRIVE #format drive (sda used here) to use as storage sudo mount /dev/$DRIVE $HOME/datadrive # mount storage to dir echo "/dev/$DRIVE ./datadrive ext4 defaults 0 0" | sudo tee -a /etc/fstab # ensure that attached storage is permanently mounted</syntaxhighlight>

Bind Storage from host proxmox to and from container/vm

Direct Bind Mount:

LXC containers support bind mounts directly, allowing you to make the host directory accessible inside the container. Edit the container’s configuration file located at /etc/pve/lxc/<VMID>.conf. Add a mount point entry like so: mp0: /datadrive/media/,mp=/media,readonly=0 ' This configuration line mounts /datadrive/media/ from the host to /media inside the container. Remove readonly=0 if you wish to have write access as well. Restart the container to apply changes: pct restart <VMID>