- New Home Server
- Installing Proxmox
- Proxmox Quirks & Configurations
- Shiny New DC
- DNS, DHCP, and Redundancy
- Active Directory Structure and Config
- File server replication with Robocopy
- Windows shares on Linux
- Install Plex on CentOS
- Ubiquiti UniFi Controller
- Centreon Monitoring
- Centreon 2 – Electric Boogaloo
In the previous article I discussed the plans for my new home server and covered the specs and overall topology. In the following articles I will get into more specifics. This one will be focusing on how I installed Proxmox on USB flash and then relocated various directories to minimize writes to the flash media to maximize its life.
For those who may not know, Proxmox is an open-source enterprise virtualization platform based on Debian Linux, KVM hypervisor, and LXC containers. More info can be found here. I downloaded the 5.0 installer via BitTorrent from the downloads page and used dd to copy it onto a USB flash drive.
1 |
dd if='/path/to/installer.iso' of='/dev/flashdrive' |
I then inserted that flash drive, along with the SanDisk UltraFit drive that was to be the target of the install, into my newly built server. I booted from the installation drive, and then chose the UltraFit drive as installation location. It was a fairly straight forward process, unfortunately I don’t remember the specifics, but I believe you select your installation disk, file system (I used ext4 which also defaults to LVM), set your root password, and assign name/IP address. It will then run through the install and instruct you to continue by pointing your browser to the web interface (https://IPorHostname:8006). I chose to first connect via SSH and install updates:
1 |
apt-get update && apt-get dist-upgrade |
I then poked around the OS a bit and discovered I was seeing some ZFS errors on boot and in journalctl, I wasn’t going to be using ZFS anyway, so went ahead and disabled it:
1 2 |
systemctl disable zfs-mount.service systemctl disable zfs-share.service |
I then noticed that the console-setup service was in a failed state and refused to start. In order to remedy that I ended up needing to uninstall/reinstall the keyboard-configuration package, which also removes console-setup.
1 2 3 4 |
apt-get remove keyboard-configuration apt-get install keyboard-configuration apt-get install console-setup systemctl enable console-setup && systemctl start console-setup |
At this point, everything was looking good and it was time to go ahead and setup my raid array. Proxmox does not officially support software raid, but acknowledge in their wiki that it is in use by experienced users, but they of course recommend hardware raid instead. So I needed to install mdadm:
1 |
apt-get install mdadm |
I am using five 1 TB drives in a Raid 5 configuration, you can ind your drives with the following command:
1 2 3 4 5 6 |
fdisk -l | grep sd Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Disk /dev/sdd: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Disk /dev/sde: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors |
Now you’re ready to create the actual array:
1 |
mdadm --create /dev/md0 --level=5 --raid-devices=5 /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde |
If I recall, I believe it took around 2 hours to create the array, you can check progress with the following command:
1 |
mdadm --detail /dev/md0 |
Once the array is built, the configuration needs to be saved so that it will be available on reboot and won’t be assigned some random device number. To accomplish that, issue the following command:
1 |
mdadm --detail --scan --verbose >> /etc/mdadm/mdadm.conf |
I also added the following line to the config to receive an email if something happens to the array (ie, a failed disk)
1 |
MAILADDR your@email.com |
In order for this to work, you’ll need to make sure that mdmonitor is running and also configure postfix to send mail to an external source (I’ll cover that in the next post).
At this point, I was ready to start creating my LVM partitions. As I mentioned previously, I needed to make some changes to keep from constantly writing to my USB boot device and causing it to fail. One of those changes was to move /var off of it. You can also accomplish this by redirecting it to RAM, but I didn’t want to lose my logs with a reboot, so I choose to create an LVM partition and mount it to /var instead. To do that, I performed the following steps:
- First I created a physical volume on /dev/md0
1 |
pvcreate /dev/md0 |
- Next, I created a volume group named RAID5
1 |
vgcreate RAID5 /dev/md0 |
- Then I created my first logical volume to use for /var, made it 15 GB in size, and named it lvvar
1 |
lvcreate -L 15G -n lvvar RAID5 |
- I then created a second logical volume to use the remaining space in the raid, and named it lvstorage
1 |
lvcreate -l 100%FREE -n lvstorage RAID5 |
- The final step was to create ext4 filesystem on each of these
1 2 |
mkfs.ext4 /dev/RAID5/lvvar mkfs.ext4 /dev/RAID5/lvstorage |
Now I was ready to relocate /var onto the newly created file system /dev/RAID5/lvvar. To do that, I performed the following:
1 2 |
mkdir /mnt/var mount /dev/RAID/lvvar /mnt/var |
I then needed to go to single user mode, so that there would be no activity in /var by issuing the command:
1 |
init 1 |
And then entering the root password.
Now I needed to backup the data in /var
1 2 |
cd /var cp -ax * /mnt/var |
Once the copy is complete, rename the exising /var directory and then create a new one
1 2 3 |
cd / mv var var.old mkdir var |
Now I needed to unmount /dev/RAID5/lvvar and remount it in /var instead
1 2 |
umount /dev/RAID5/lvvar mount /dev/RAID5/lvvar /var |
Add an entry to /etc/fstab
1 |
/dev/RAID5/lvvar /var ext4 noatime,nodiratime,async 0 0 |
And finally, return to multi-user
1 |
init 3 |
I then created a mount point for the remainder of the raid
1 |
mkdir /mnt/vmstorage |
And added an entry to /etc/fstab for it
1 |
/dev/RAID5/lvstorage /mnt/vmstorage ext4 noatime,nodiratime,async,data=writeback,errors=remount-ro 0 0 |
One more change that I wanted to make was to mount /tmp to tmpfs (aka into memory), to accomplish that in Proxmox (which is based on Debian Stretch) you can issue the following commands:
1 2 |
cp /usr/share/systemd/tmp.mount /etc/systemd/system/ systemctl enable tmp.mount |
The final change was to completely disable swap, the server has 32 GB of RAM, so I didn’t feel it was going to be needed at any point, so rather than move it to disk, I just got rid of it. To do that, issue the command:
1 |
swapoff -a |
and then remove any mounts for swap from /etc/fstab.
At this point, I rebooted the system to make sure everything mounted ok, verified there were no issues, and I was then ready to start creating VMs.
Leave a Reply