Advice on migrating from Ubuntu server to another server OS


Hi all. I'm currently running a home server using Ubuntu OS, but I'd like to try and explore other options for operating systems to better my skills with linux/unix.

Currently I'm considering switching to Fedora server (though feedback is welcome) because I've been running it as my daily OS for a few months now and I quite like it. I'm also looking at Debian server because that's what my old professor used and he did nothing but speak its praises.

Only issue is I'm concerned about data loss from moving the installation. Currently, the server is setup to run several Docker images running my programs. While moving over the images shouldn't be difficult whatsoever, I'm afraid my storage setup might not be so easy. Currently, it's two 4TB hard drives running in a logical volume. I'd love to simply be able to move over all the files to a backup drive, but I don't have anywhere I can store >5TB of files as a backup.

I googled around, but I couldn't find too many guides on migrating logical volumes. The one or two I did find were most definitely written for someone with far more linux knowledge than I have as a relative noob, so any advice would be extremely welcome!

in reply to kboy101222

Okay, more details will be required, but here's what I'm thinking will work.

One of the benefits of an LVM is its pretty easy to resize it.

The outline of what you can do is this (and we can refine the steps with more details)

Right now you've got your 8TB physical volume, and within that, you should have your volume group, and within that volume group, you should have one or more logical volums that are mounted for your system. The idea is to resize the existing logical volume by shrinking it, creating addition space within the volume group that can be used to create a new logical volume. Then, that new logical volume can be used to install Fedora.

Depending on how much free space you have on the entire physical volume, you could potentially dual boot Fedora and Ubuntu. Roughly speaking, the steps would look like this:

WARNING: These steps are not exhaustive because I don't know the full details of your system. This is not meant to be a guide for you to immediately implement and follow, but to help get you down the right path DO NOT FOLLOW THESE STEPS WITHOUT FIRST FULLY UNDERSTANDING HOW THIS WILL APPLY TO YOUR UNIQUE SYSTEM SETUP.

  1. Download a Linux ISO of your choice. Ubuntu, Fedora, it doesn't really matter. This one is going to be used to live boot on your server so you can make adjustments to your lvm without having the lvm mounted.
  2. Boot into the live usb
  3. Once you get to the desktop environment of the live usb dismiss any installation prompts, etc and open a terminal
  4. Install the logical volume tools with sudo whatever-the-package-manager-install-command-is lvm2
  5. If your volume group is encrypted (typically with LUKS), you'll need to decrypt it to make sizing changes to the lvm(s) in the volume group. You can decrypt it with:
    1. cryptsetup open /dev/your-disk-here name-of-your-volume-group
    2. For example, on my system if I were doing this it would be cryptsetup open /dev/nvme0n1p2 server (I very creatively named my server volume group server)


  6. Once you can access your volume group, you can use the df command to see how much space is free in your volume group. The full command you'll want to run is:
    1. sudo df -h
    2. This command will list all mounted disks along with filesystem usage data. With this you should be able to determine how much free space you have in your volume group.


  7. Once you've determined how much free space you have, you can decide how big you want to make your new logical volume. For example, if your current usage is 6TB out of the 8TB total, you could resize the current logical volume down to 7TB, and then create a new logical volume that's 1TB in size for the Fedora install
  8. You will do the resize using the lvm2 tools installed. The command to shrink the logical volume looks like this:
    1. sudo lvreduce --resizefs --size -1TB /dev/your-volume-group/the-lvm-name


  9. Once you've shrunk the lvm, You can create your new lvm

IMPORTANT NOTES:

  1. If at all possible, you should really back up the data. If you don't have any kind of backups in place, you're risking losing all of your data, not just in doing this operation, but in general.
  2. If you want to dual boot, things are more complicated because of where your /boot exists
in reply to harsh3466

Sorry this took a while, I got distracted. Trying to also learn Dart cause why not.

Here's the output of lsblk

NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda                         8:0    0  3.6T  0 disk 
├─sda1                      8:1    0    1G  0 part /boot/efi
├─sda2                      8:2    0    2G  0 part /boot
└─sda3                      8:3    0  3.6T  0 part 
  └─ubuntu--vg-ubuntu--lv 252:0    0  7.3T  0 lvm  /
sdb                         8:16   0  3.6T  0 disk 
└─ubuntu--vg-ubuntu--lv   252:0    0  7.3T  0 lvm  /
in reply to kboy101222

Perfect. So you've got separate /boot and /boot/efi partitions, which means dual booting will be much easier if you want to do that.

The ubuntu--vg-ubuntu-lv is the logical volume you'll want to resize. So now we need to see how much space is available on the volume. To get that, run the command sudo df -h and paste that output into a comment.

From there we can figure out how much space you have and how you might want to resize the volume to prep for a new install.

What is challenging about this is that your data is under your root (/) mount, which is also the ubuntu os. If in the end you want to entirely remove ubuntu, it'll be a little trickier than if your data was in a separate logical volume that you mounted into your root system during boot.

For example many people have a separate logical volume for /home, which makes it easier to switch distros while preserving your home folder with all of your user data, config files, etc...

But that's getting a little ahead of ourselves. Start with sudo df -h for the filesystem usage info and we can go from there.

in reply to harsh3466

Sorry, I've been running around like a headless chicken today! Here's the output of sudo df -h
Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              3.2G  5.9M  3.2G   1% /run
efivarfs                           128K   17K  107K  14% /sys/firmware/efi/efivars
/dev/mapper/ubuntu--vg-ubuntu--lv  7.2T  3.8T  3.2T  55% /
tmpfs                               16G     0   16G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
/dev/sda2                          2.0G  193M  1.6G  11% /boot
/dev/sda1                          1.1G  6.2M  1.1G   1% /boot/efi
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/bcfc6cdd2b2dade1c62a74e2471c7854b9c196a3c0f078f797d70113964ede8d/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/a35b73132ddc1e269aa9ebe575d0e5e2e73e6f08cdb825b0887f91e0a4121cef/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/e520dbd210290edb01c7bf8d37cbdfc8e03b7a163dbd456a17868a71c4550397/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/89b5c5806c2482d9318cbf770f836cedb06286a2dd49e7c227fea02e198df2af/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/fa91a69c4a453e2fa734ebe4c83dd8ee77d70749f16f2d4c63f90aaeb4c50d31/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/4dd7bc11c887471609493f01328394b25f7dd2bb535f46f49c42549ad687d862/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/9ee1766864b68a61bc3ba27aa98404ed46b76f6e9e6f0731ed445eb4d4112153/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/13bfb2554321f24c9648cfbda84ade6988df77543116688e6f08481fcc5bb0fa/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/8c271d4bc303852dedc7e6eea9a580f0ffd0dea9a066c9f0b7e5b926b2c5c0be/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/2fa7a2ecc5219b708f88eb3ed080657169306e35be14986500282cb9c455bbc1/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/1c206df8e1e12b7ca2acfec4b9e6617fd155c432f2b22bf34eb201f32f1fe3d6/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/36b806dc4db7596718766e344cff0db305ec4509e6fbdc673b394fa5cb62d9b3/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/40f4535813fe79417d0f040fdd53a5058bb29469026fc7a8eabb2b92db16eadf/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/4c301571ba732358aeffd767b5850c0db56efaf0d561016e8fc077d87187a26a/merged
overlay                            7.2T  3.8T  3.2T  55% /var/lib/docker/overlay2/73f9cd053d43eaf8707c481e68bb1beec843b7153a58dc9e99f467a637b33e9c/merged
tmpfs                              3.2G   12K  3.2G   1% /run/user/1000
in reply to kboy101222

I think basically all Linux distros will support lvm? It seems like some installers do not, but as long as you leave the disks alone during installation it should be fine. As for distro, Debian is a great choice for a server. I've had no issues over the years since I ditched Ubuntu since they keep moving towards commercialization. If you want to learn more compared to Ubuntu you might not learn much though. Fedora could offer more learning, though honestly it's kind of all the same.
in reply to kboy101222

@kboy101222 I would not recommend Fedora for a server. It is painful at best. No support for NIS, the use of SeLinux which can take half an hour at boot to re-label before the system becomes operational, and the fact that they don't give a rip about backwards compatibility when they make changes are all reasons to avoid. I used to use Fedora but migrated to Ubuntu to get away from those issues. The latter is far from perfect but hands down superior to Fedora.
in reply to kboy101222

I'm currently running a home server using Ubuntu OS, but I'd like to try and explore other options for operating systems to better my skills with linux/unix.


What are you hoping to explore? Distrohopping servers is pretty much pointless, especially if you're using docker.

Like you're going to use dnf to install docker instead of apt, maybe configure selinux instead of apparmor, and that's it. Definitely not worth it IMO.

in reply to Shareni

@Shareni @kboy101222 The main difference between the distros that is hard to get around is the package manager, in that sense Debian based apt/apt-get/dpkg, Redhat based dnf/rpm, Arch/Manjaro pacman (glorified tar). Of all the formats I really like Arch's manager because it's easy to manually extract packages but it's really easy to get into dependency loop hell if you go too long between updates, but everything else, what desktop you use, what container's you use, all flexible and exchangeable fluff.