Setting Up RAID-1 with NFS on Proxmox
This document guide you through setting up RAID-1 with your sda and sdb drives, then configuring NFS access for your Ubuntu/Linux servers.
Step 1: Backup and Prepare
First, verify the drives and ensure no important data exists:
lsblk -f
# Verify sda and sdb are the correct drives (3.6TB each)Step 2: Remove Existing Configurations
Clean up any existing partition tables:
# Unmount if mounted
umount /dev/sda* 2>/dev/null
umount /dev/sdb* 2>/dev/null
# Wipe filesystem signatures
wipefs -a /dev/sda
wipefs -a /dev/sdb
# Zero out partition tables
sgdisk --zap-all /dev/sda
sgdisk --zap-all /dev/sdbStep 3: Install MDADM (if not already installed)
apt update
apt install mdadm -yStep 4: Create RAID-1 Array
# Create the RAID-1 array
mdadm --create /dev/md0 \
--level=1 \
--raid-devices=2 \
/dev/sda \
/dev/sdb
# Monitor the sync process (this will take time for 3.6TB)
watch cat /proc/mdstat
# Press Ctrl+C to exit watchStep 5: Create Filesystem
Here, raid1-storage is a label used to identify the filesystem, use your desired name.
# Create ext4 filesystem (or xfs if you prefer)
mkfs.ext4 -L raid1-storage /dev/md0
# For XFS (alternative, better for large files):
# mkfs.xfs -L raid1-storage /dev/md0Step 6: Configure RAID to Persist
# Save RAID configuration
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
# Update initramfs
update-initramfs -uStep 7: Mount the RAID Array
# Create mount point
mkdir -p /mnt/raid1-storage
# Mount the array
mount /dev/md0 /mnt/raid1-storage
# Add to fstab for automatic mounting
echo '/dev/md0 /mnt/raid1-storage ext4 defaults 0 2' >> /etc/fstab
# Verify
df -h /mnt/raid1-storageStep 8: Install and Configure NFS Server
# Install NFS server
apt install nfs-kernel-server -y
# Create directory structure for your services
mkdir -p /mnt/raid1-storage/nextcloud
mkdir -p /mnt/raid1-storage/shared
# Set appropriate permissions
chmod 755 /mnt/raid1-storage/nextcloud
chmod 755 /mnt/raid1-storage/sharedStep 9: Configure NFS Exports
Edit the exports file:
nano /etc/exportsAdd your NFS shares (replace IP ranges with your network):
bash
# For specific subnet (recommended)
/mnt/raid1-storage/nextcloud 192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)
/mnt/raid1-storage/shared 192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)
# Or for specific IPs
# /mnt/raid1-storage/nextcloud 192.168.1.100(rw,sync,no_subtree_check,no_root_squash)NFS Options explained:
rw- read/write accesssync- synchronous writes (safer but slower)no_subtree_check- improves reliabilityno_root_squash- allows root on client to access as root (be careful with this)
Apply the configuration:
exportfs -ra
systemctl restart nfs-kernel-server
systemctl enable nfs-kernel-serverStep 10: Configure Firewall (if enabled)
# Allow NFS through firewall
ufw allow from 192.168.1.0/24 to any port nfsStep 11: Mount on Ubuntu Clients
On your Ubuntu servers:
# Install NFS client
apt install nfs-common -y
# Create mount point
mkdir -p /mnt/nextcloud-data
# Mount NFS share
mount -t nfs proxmox-ip:/mnt/raid1-storage/nextcloud /mnt/nextcloud-data
# Add to fstab for persistence
echo 'proxmox-ip:/mnt/raid1-storage/nextcloud /mnt/nextcloud-data nfs defaults 0 0' >> /etc/fstabVerification Commands
# On Proxmox - Check RAID status
mdadm --detail /dev/md0
cat /proc/mdstat
# Check NFS exports
showmount -e localhost
# On Ubuntu client - Check NFS mount
df -h
mount | grep nfsImportant Notes
- RAID sync time: The initial RAID sync will take several hours for 3.6TB drives. The array is usable during sync but performance will be affected.
- Permissions for Nextcloud: You'll likely need to set ownership for the Nextcloud user:
chown -R www-data:www-data /mnt/raid1-storage/nextcloud- Network performance: Consider using 10GbE or bonded network interfaces for better NFS performance.
- Monitoring: Set up RAID monitoring:
echo '[email protected]' >> /etc/mdadm/mdadm.conf