no matching services found
Installing ZFS on Root in a Running VPS
This guide explains how to install ZFS as the root filesystem of a VPS that contains an existing Linux installation without causing data loss. The VPS will have a small EXT4 boot partition for GRUB2 with the kernel and initrd, and a large ZFS pool mounted on root with compression enabled. Most commands will be issued from a live CD image and a workaround will be shown if the VPS does not support mounting ISO images.
- Index:
- 1. Back up the data
- 2. Boot a live OS image
- 3. Install ZFS on the live OS environment
- 4. Partition the VPS disk
- 5. Install ZFS on the VPS disk
- 6. Restore the backup to the new ZFS root filesystem
- 7. Install GRUB2
- 8. Boot into the ZFS root pool
- Step 1: Back up the data
-
If you have a second VPS or home computer with enough space to store the backup data, from within that computer run:
where target is the hostname of the VPS being converted. This will copy the entirety of the root filesystem over SSH to the backup machine, and restoring this backup onto the target VPS later on will be straightforward. If you need to compress the backup for lack of space, you can alternatively create a compressed TGZ archive:
# rsync -aqrxz root@target:/ backup.d
However, when restoring a root filesystem from a TAR archive, it will be necessary to recreate all symlinks whose targets have absolute pathnames, because TAR converts their targets to relative pathnames, so using rsync is the simpler alternative. How to properly restore the TAR archive will be shown later.# ssh root@target "tar -cf - --acls --xattrs --one-file-system --absolute-names /" | gzip -1 >backup.tgz
- Step 2: Boot a live OS image
-
The conversion to ZFS will be done from a live CD operating system. Depending on how capable your VPS control panel is, it may already have a live OS image ready to boot. Alternatively, you can download a Debian live ISO from the Debian mirror and upload it to your VPS control panel, then boot the ISO from there; this will work fine even if your VPS runs a different distribution. Be careful to use a live OS ISO image, not an installation ISO, because installation images lack apt and are unable to install the necessary software onto the live environment. If your VPS control panel supports booting from a user-supplied ISO image, skip to Step 3, otherwise you can still boot the downloaded ISO by converting a swap partition, if present, into EXT4 and storing the ISO in that reclaimed storage space, then GRUB2 may be configured to boot from that ISO. This is done as follows:
# fdisk --list /dev/vda
Disk /dev/vda: 35 GiB, 37580963840 bytes, 73400320 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x495b5ce4
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 69203583 69201536 33G 83 Linux
/dev/vda2 69203584 73397887 4194304 2G 82 Linux swap
# swapoff /dev/vda2 # disable swap partition
# mkfs.ext4 /dev/vda2 # create EXT4 filesystem
# mount /dev/vda2 /mnt # mount the reclaimed space
# mkdir /mnt/images/
# wget -O /mnt/images/image_file.iso <image_URL>
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Live ISO" {
set ISOFile="/images/image_file.iso"
loopback loop (hd0,2)$ISOFile
linux (loop)/live/vmlinuz boot=live findiso=$ISOFile
initrd (loop)/live/initrd.img
}
update-grub2
- Step 3: Install ZFS on the live OS environment
-
Boot the live OS image and access its terminal. Then install the ZFS packages on the live OS environment:
# echo deb http://deb.debian.org/debian stretch contrib >> /etc/apt/sources.list
# apt update
# apt install zfs-dkms
# modprobe zfs
- Step 4: Partition the VPS disk
-
There are two alternative scenarios for partitioning the VPS disk:
- If you stored the live ISO in /dev/vda2 you may not alter that partition now because the live system depends on it, and no partitioning whatsoever will be done to the VPS disk. ZFS will be formatted on the existing /dev/vda2 partition, and /dev/vda1 will remain as is and later be repurposed as your permanent boot partition for storing the kernel and initrd. Skip to Step 5.
-
If your live environment does not depend on an ISO file stored on the VPS disk, repartition the disk by creating one small boot partition for GRUB2, and one large partition for the ZFS root that extends over all remaining disk space. Execute fdisk to create the two following partitions:
# fdisk /dev/vda
Command (m for help): p
Disk /dev/vda: 35 GiB, 37580963840 bytes, 73400320 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x495b5ce4
Device Boot Start End Sectors Size Id Type
/dev/vda1 2048 69203583 69201536 33G bf Solaris
/dev/vda2 * 69203584 73397887 4194304 2G 83 Linux
# mkfs.ext4 /dev/vda2
- Step 5: Install ZFS on the VPS disk
-
Format /dev/vda1 as a ZFS volume:
# zpool create -o ashift=12 \
-O acltype=posixacl -O canmount=on -O compression=zstd \
-O dnodesize=auto -O normalization=formD -O relatime=on -O xattr=sa \
-O mountpoint=/ -R /mnt \
rpool /dev/vda1
- Step 6: Restore the backup to the new ZFS root filesystem
-
Install the OpenSSH server on the live environment to receive the backup data from the backup VPS:
# apt install openssh-server
# passwd
# service restart ssh
## from the backup VPS
# rsync -arxz backup.d/* root@target:/mnt/
## from the backup VPS
# cat backup.tgz | ssh root@target "tar -C /mnt -zaxf -"
## from the backup VPS
# tar -tvf backup.tgz | egrep -- '->' >list_of_symlinks.txt
## from the backup VPS
# scp list_of_symlinks.txt root@target:/mnt/root/
## from the chroot environment
while read -r row; do
src=$(echo "$row" | grep -Po '(?<=[0-9]{2}:[0-9]{2} )[^ ]+')
tgt=$(echo "$row" | grep -Po '(?<= -> ).+')
echo "linking: $src -> $tgt"
ln -fs "$tgt" "$src"
done </root/list_of_symlinks.txt
- Step 7: Install GRUB2
-
If you are inside the chroot, exit it and return to the live environment. Then bind the virtual filesystems to /mnt and mount the boot partition:
# mount --bind /dev /mnt/dev
# mount --bind /proc /mnt/proc
# mount --bind /sys /mnt/sys
# mount /dev/vda2 /mnt/boot
# chroot /mnt
# apt install pkg-dev linux-headers-amd64 linux-image-amd64
# apt install zfs-dkms zfs-initramfs
# apt install grub-pc
# update-initramfs -u -k all
## this is /etc/default/grub
GRUB_CMDLINE_LINUX="root=ZFS=rpool"
# update-grub
# grub-install /dev/vda
- Step 8: Boot into the ZFS root pool
-
The system is ready, fully restored from the backup, and may be booted. Exit the chroot and umount all virtual filesystems, then export the ZFS root pool:
# exit # exit the rpool chroot
# umount /mnt/dev
# umount /mnt/proc
# umount /mnt/sys
# umount /mnt/boot
# umount /mnt
# zpool export -a
# reboot
Hosting a Minecraft Server: VDS or Laptop?
- Hosting on a Laptop
- Hosting a Minecraft server on your laptop seems like a convenient and cost-effective solution, especially if you already own a capable machine. This approach allows you to have immediate control over the server environment, making it easy to manage and configure settings directly. However, this convenience comes with some trade-offs.
- One of the main drawbacks is performance. Running a Minecraft server can be resource-intensive, consuming a substantial amount of CPU, RAM, and bandwidth. This can significantly slow down your laptop, especially if it is not a high-end model. You might experience lag and potential crashes during intensive gameplay if your laptop's RAM is insufficient, which can be frustrating for both you and your players.
- Reliability is another concern. Your server's uptime is directly tied to your laptop's stability and internet connection. Any power outages, hardware issues, or network disruptions can lead to unexpected downtime, disrupting the gaming experience. For example, imagine hosting a server for a group of friends. During an important in-game event, your laptop overheats and shuts down, causing frustration and disruption for all players involved.
- Additionally, hosting a Minecraft server with network ports open to the world exposes it to security risks. If you plan to run a public host and let anyone into your server, you will need to implement robust security measures, such as firewalls and antivirus software, and protect against DDoS. These risks can be mitigated by configuring the server as private and restrict access to anyone but the friends you trust.
- Hosting on a VDS
- In contrast, hosting a Minecraft server on a VDS offers several compelling benefits that can enhance the overall gaming experience. VDSs are designed to handle server loads, providing better performance and stability. This means you can expect smoother gameplay with minimal lag, even during peak times.
- One of the key advantages of using a VDS is reliability. VDS providers often have redundant power and network connections, ensuring higher uptime and reliability. This means your server will be available to players more consistently, without the risk of unexpected downtime due to hardware or network issues.
- Scalability is another significant benefit. With a VDS, you can easily upgrade resources such as CPU, RAM, and storage as your server grows. This flexibility allows you to accommodate more players and larger worlds without compromising performance. Additionally, VDS providers typically offer robust security measures and regular backups, protecting your server from potential threats.
- Network latency is another important factor to consider. VDS hosting often provides better connectivity and lower latency compared to a personal laptop. This is because VDS providers usually have high-speed internet connections and are located in data centers with optimized network infrastructure. Lower latency means faster response times and a smoother gaming experience for players, especially those connecting from different geographical locations.
- For instance, hosting a public server on a VDS allows you to support a larger player base with consistent performance. Even during peak times, the server remains stable, providing a seamless experience for all players. This level of reliability and performance is difficult to achieve with a personal laptop.
- While VDS hosting comes with a monthly fee, the investment is often justified by the enhanced performance, reliability, and security it provides. Moreover, setting up and managing a VDS requires some technical knowledge, but many providers offer managed services to help with the initial setup and ongoing maintenance.
- Final Thoughts
- In summary, while hosting a Minecraft server on a personal laptop can be convenient and cost-effective, it comes with limitations in terms of performance, reliability, and security. On the other hand, using a VDS offers superior performance, higher reliability, and robust security measures, making it a compelling choice for Minecraft enthusiasts. By carefully weighing the pros and cons, you can make an informed decision that best suits your needs and ensures an optimal gaming experience for you and your players.
RackNerd Black Friday 2024 Offers
RackNerd has released four new VPS offers in anticipation of Black Friday 2024 named the 11.11 Specials. Let's have a look and compare prices and specifications and see who their direct competitors are.
RackNerd VPS List:
These are some of the 11.11 Specials just released by RackNerd, you can see the full list by executing ❯ this search query.
RackNerd — $0.86 / month
1 Intel Cores (shared)
1024 MB RAM
20 GB SSD
4000 GB/month bandwidth
1.0 Gbps port speed
IPv4
Hosted in U.S.A. 🇺🇸
RackNerd — $1.58 / month
2 Intel Cores (shared)
2048 MB RAM
40 GB SSD
3000 GB/month bandwidth
1.0 Gbps port speed
IPv4
Hosted in U.S.A. 🇺🇸
RackNerd — $2.08 / month
3 Intel Cores (shared)
2048 MB RAM
40 GB SSD
3000 GB/month bandwidth
1.0 Gbps port speed
IPv4
Hosted in U.S.A. 🇺🇸
RackNerd's Competitors:
Now let's take a look at what RackNerd's direct competitors have to offer to match the same hardware specifications, and at what price point. Here ❯ you can see the full list. At the time of writing, ColoCrossing matches all of RackNerd's specifications and manages to strike a better price for their VPSs. Remember however that all monthly prices indexed in the database are obtained by dividing the annual prices by 12 for the purpose of data normalization.
ColoCrossing — $0.83 / month
1 Intel Cores (shared)
1024 MB RAM
25 GB SSD
20480 GB/month bandwidth
1.0 Gbps port speed
IPv4
Hosted in U.S.A. 🇺🇸
RackNerd — $0.86 / month
1 Intel Cores (shared)
1024 MB RAM
20 GB SSD
4000 GB/month bandwidth
1.0 Gbps port speed
IPv4
Hosted in U.S.A. 🇺🇸
ColoCrossing — $1.50 / month
1 Intel Cores (shared)
2048 MB RAM
20 GB SSD
20480 GB/month bandwidth
1.0 Gbps port speed
IPv4
Hosted in U.S.A. 🇺🇸
The Ultimate VPS Directory and VPS List Comparison Tool
VPS Price Tracker is among the most comprehensive VPS Directories available online. With over 60,000 VPSs from nearly a hundred providers, this search engine aggregates and indexes a vast array of offers, making it easy to compare and choose the best VPS for your project. My mission is to help you find the perfect Virtual Private Server (VPS) that meets your specific needs and budget.
The user-friendly interface allows you to search for VPSs based on a multitude of parameters, including CPU class, memory size, disk type, port speed and bandwidth, and a customized VPS list is compiled just for you with the results of your search. This level of customization ensures that you can find the ideal VPS that aligns with your requirements.
Each VPS listing in the directory is presented in a compact product card, showcasing the most relevant information at a glance. This includes details such as monthly price, disk type and size, memory, CPU, and more. Additionally, you can view the complete data for each VPS, including whether it supports IPv4, IPv6, and various virtualization types from the Info page.
VPS Price Tracker is designed to be the reference point for all your VPS needs. Whether you're a seasoned developer or just starting out, this comprehensive VPS directory will help you make an informed decision and find the perfect VPS for your project.
Familiarize yourself with the search tool on the sidebar and discover the ideal VPS for your needs. With this extensive database and powerful search engine, you're sure to find the perfect VPS that meets your requirements and budget.
Read more articles