Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Backup

First, you need to carefully make a backup.

  1. Save the list of installed packages (rpm -qa) just in case.¹
  2. Save the list of manually installed packages (dnf leaves using the dnf leaves plugin). This will be needed later if you want to reinstall all the extra packages you've installed before.¹
  3. For every user installed, take a copy of the dconf database running dconf dump / as their user ID.¹
  4. Create a copy of /etc. Do this as root or with sudo because otherwise you will be missing important files due to missing permissions. This will backup system-wide configuration.²
  5. Take a backup of a list of all enabled systemd units using systemctl list-unit-files | grep enabled
  6. If you have /opt, make a backup too.²
  7. If you are interested in keeping logs, etc., or are using a web server, backup the relevant parts of /var too. This is not normally needed.
  8. Backup the output of rpm -Va. Have a look at this list as it will contain all files which differ from package defaults. This is especially important for config files which may reside outside of /etc, but also for permissions.
  9. Take a full backup of /home.³ If it is on a separate partition, take an image, e.g. by using GNOME disks or dd (dangerous). If it is not on a separate partition, consider putting it on a separate partition as this will ease future reinstallations. If you don't have a separate partition, then carefully back-up your /home and store it useing tar or cp -a ... to ensure the permissions of all files remain unchanged when you restore.
  10. Take a full image (backup) of all disk(s) connected to that computer just in case anything goes wrong.
  11. Have a look at the backups to make sure that they actually work. If the backup failed (e.g. corrupted data) and you rely on it, you have a problem (or several problems).

¹: Do this from the currently running system or through a chroot environment from a live image. ²: Do this either from the currently running system or a live image. ³: Do this from a live image, not from the running system! Otherwise file modifications will be lost. You may also get problems with permissions.

Fedora installation

Boot from any installer media and do a full installation, wiping the root partition. You do not have to wipe a separate /home partition.

Restoring configuration

  1. Boot into the new installation.
  2. Go through the list generated by dnf leaves above and reinstall all the packages you may still need.
  3. With the information from rpm -Va and your backup of /etc, restore configuration for some of the software installed. Using a diff tool such as vimdiff (not that easy to learn) or meld (not suitable for root access) may help you. Systemd units need special handling: You can enable/disable them through systemctl creating the symlinks instead of creating them by hand. It is important to restore files like /etc/shadow to make sure that users still have the same name and ID, otherwise you will run into massive permissions problems.
  4. Reinstall or restore your stuff to /opt and possibly other stuff in /var
  5. If /home is on a separate partition, modify /etc/fstab accordingly to mount it, then reboot. If /home is not on a separate partition, restore the contents of /home from your backup. It is very important that you do this step after restoring /etc/shadow.

This guide was created with a little help from answer to question 51259, an AskUbuntu answer and older tips I cannot remember where they came from.

Backup

First, you need to carefully make a backup.

  1. Save the list of installed packages (rpm -qa) just in case.¹
  2. Save the list of manually installed packages (dnf leaves using the dnf leaves plugin). This will be needed later if you want to reinstall all the extra packages you've installed before.¹
  3. For every user installed, take a copy of the dconf database running dconf dump / as their user ID.¹
  4. Create a copy of /etc. Do this as root or with sudo because otherwise you will be missing important files due to missing permissions. This will backup system-wide configuration.²
  5. Take a backup of a list of all enabled systemd units using systemctl list-unit-files | grep enabled
  6. If you have /opt, make a backup too.²
  7. If you are interested in keeping logs, etc., or are using a web server, backup the relevant parts of /var too. This is not normally needed.
  8. Backup the output of rpm -Va. Have a look at this list as it will contain all files which differ from package defaults. This is especially important for config files which may reside outside of /etc, but also for permissions.
  9. Take a full backup of /home.³ If it is on a separate partition, take an image, e.g. by using GNOME disks or dd (dangerous). If it is not on a separate partition, consider putting it on a separate partition as this will ease future reinstallations. If you don't have a separate partition, then carefully back-up your /home and store it useing tar or cp -a ... to ensure the permissions of all files remain unchanged when you restore.
  10. Take a full image (backup) of all disk(s) connected to that computer just in case anything goes wrong.
  11. Have a look at the backups to make sure that they actually work. If the backup failed (e.g. corrupted data) and you rely on it, you have a problem (or several problems).

¹: Do this from the currently running system or through a chroot environment from a live image. ²: Do this either from the currently running system or a live image. ³: Do this from a live image, not from the running system! Otherwise file modifications will be lost. You may also get problems with permissions.

Fedora installation

Boot from any installer media and do a full installation, wiping the root partition. You do not have to wipe a separate /home partition.

Restoring configuration

  1. Boot into the new installation.
  2. Go through the list generated by dnf leaves above and reinstall all the packages you may still need.
  3. With the information from rpm -Va and your backup of /etc, restore configuration for some of the software installed. Using a diff tool such as vimdiff (not that easy to learn) or meld (not suitable for root access) may help you. Systemd units need special handling: You can enable/disable them through systemctl creating the symlinks instead of creating them by hand. It is important to restore files like /etc/shadow to make sure that users still have the same name and ID, otherwise you will run into massive permissions problems.
  4. Reinstall or restore your stuff to /opt and possibly other stuff in /var
  5. If /home is on a separate partition, modify /etc/fstab accordingly to mount it, then reboot. If /home is not on a separate partition, restore the contents of /home from your backup. It is very important that you do this step after restoring /etc/shadow.
  6. For each user account, you may need to restore the dconf database. This is not likely, but check back if your configuration has been kept or removed to defaults.

This guide was created with a little help from answer to question 51259, an AskUbuntu answer and older tips I cannot remember where they came from.

Preparation

  • Make sure that you have enough space for backing up all your disk
  • Check the "Common bugs" page for the new Fedora release, e.g. for Fedora 28 for any issues. If you are planning to install an unstable release or a version just released a few days ago, check the Blocker bugs for critical bugs which may affect you.

Backup

First, you need to carefully make a backup.

  1. Save the list of installed packages (rpm -qa) just in case.¹
  2. Save the list of manually installed packages (dnf leaves using the dnf leaves plugin). This will be needed later if you want to reinstall all the extra packages you've installed before.¹
  3. For every user installed, take a copy of the dconf database running dconf dump / as their user ID.¹
  4. Create a copy of /etc. Do this as root or with sudo because otherwise you will be missing important files due to missing permissions. This will backup system-wide configuration.²
  5. Take a backup of a list of all enabled systemd units using systemctl list-unit-files | grep enabled
  6. If you have /opt, make a backup too.²
  7. If you are interested in keeping logs, etc., or are using a web server, backup the relevant parts of /var too. This is not normally needed.
  8. Backup the output of rpm -Va. Have a look at this list as it will contain all files which differ from package defaults. This is especially important for config files which may reside outside of /etc, but also for permissions.
  9. Take a full backup of /home.³ If it is on a separate partition, take an image, e.g. by using GNOME disks or dd (dangerous). If it is not on a separate partition, consider putting it on a separate partition as this will ease future reinstallations. If you don't have a separate partition, then carefully back-up your /home and store it useing tar or cp -a ... to ensure the permissions of all files remain unchanged when you restore.
  10. Take a full image (backup) of all disk(s) connected to that computer just in case anything goes wrong.
  11. Have a look at the backups to make sure that they actually work. If the backup failed (e.g. corrupted data) and you rely on it, you have a problem (or several problems).

¹: Do this from the currently running system or through a chroot environment from a live image. ²: Do this either from the currently running system or a live image. ³: Do this from a live image, not from the running system! Otherwise file modifications will be lost. You may also get problems with permissions.

Fedora installation

Boot from any installer media and do a full installation, wiping the root partition. You do not have to wipe a separate /home partition.partition. You need to wipe any partition containing the boot manager (/boot) or the system-managed folders below /usr. If you have a separate partition for /var, you probably should wipe it too, the same is true for /etc.

Restoring configuration

  1. Boot into the new installation.
  2. Go through the list generated by dnf leaves above and reinstall all the packages you may still need.
  3. With the information from rpm -Va and your backup of /etc, restore configuration for some of the software installed. Using a diff tool such as vimdiff (not that easy to learn) or meld (not suitable for root access) may help you. Systemd units need special handling: You can enable/disable them through systemctl creating the symlinks instead of creating them by hand. It is important to restore files like /etc/shadow to make sure that users still have the same name and ID, otherwise you will run into massive permissions problems.
  4. Reinstall or restore your stuff to /opt and possibly other stuff in /var
  5. If /home is on a separate partition, modify /etc/fstab accordingly to mount it, then reboot. If /home is not on a separate partition, restore the contents of /home from your backup. It is very important that you do this step after restoring /etc/shadow.
  6. For each user account, you may need to restore the dconf database. This is not likely, but check back if your configuration has been kept or removed to defaults.
  7. Make sure your SELinux labels are ok. Run fixfiles onboot as root or with sudo to make SELinux relabel all the filesystem on next boot (this will take a while).

This guide was created with a little help from answer to question 51259, an AskUbuntu answer and older tips I cannot remember where they came from.

EDIT 1: Added "Preparation" section. Added more details on which partitions to wipe and which to keep. Added step 7 below "Restoring".

Preparation

  • Make sure that you have enough space for backing up all your disk
  • Check the "Common bugs" page for the new Fedora release, e.g. for Fedora 28 for any issues. If you are planning to install an unstable release or a version just released a few days ago, check the Blocker bugs for critical bugs which may affect you.

Backup

First, you need to carefully make a backup.

  1. Save the list of installed packages (rpm -qa) just in case.¹
  2. Save the list of manually installed packages (dnf leaves using the dnf leaves plugin). This will be needed later if you want to reinstall all the extra packages you've installed before.¹
  3. For every user installed, take a copy of the dconf database running dconf dump / as their user ID.¹
  4. Create a copy of /etc. Do this as root or with sudo because otherwise you will be missing important files due to missing permissions. This will backup system-wide configuration.²
  5. Take a backup of a list of all enabled systemd units using systemctl list-unit-files | grep enabled
  6. If you have /opt, make a backup too.²
  7. If you are interested in keeping logs, etc., or are using a web server, backup the relevant parts of /var too. This is not normally needed.
  8. Backup the output of rpm -Va. Have a look at this list as it will contain all files which differ from package defaults. This is especially important for config files which may reside outside of /etc, but also for permissions.
  9. Take a full backup of /home.³ If it is on a separate partition, take an image, e.g. by using GNOME disks or dd (dangerous). If it is not on a separate partition, consider putting it on a separate partition as this will ease future reinstallations. If you don't have a separate partition, then carefully back-up your /home and store it useing tar or cp -a ... to ensure the permissions of all files remain unchanged when you restore.
  10. Take a full image (backup) of all disk(s) connected to that computer just in case anything goes wrong.
  11. Have a look at the backups to make sure that they actually work. If the backup failed (e.g. corrupted data) and you rely on it, you have a problem (or several problems).

¹: Do this from the currently running system or through a chroot environment from a live image. ²: Do this either from the currently running system or a live image. ³: Do this from a live image, not from the running system! Otherwise file modifications will be lost. You may also get problems with permissions.

Fedora installation

Boot from any installer media and do a full installation, wiping the root partition. You do not have to wipe a separate /home partition. You need to wipe any partition containing the boot manager (/boot) or the system-managed folders below /usr. If you have a separate partition for /var, you probably should wipe it too, the same is true for /etc.

If you are using LVM, a RAID, a LUKS container or a btrfs multi-disk layout, you do not need to remove these. Just remove and re-create the partitions (or subvolumes in case of btrfs) as described above. If you are using a LUKS container in post-2018, I recommend you remove and regenrate it using the LUKS2 layout for improved security.

Restoring configuration

  1. Boot into the new installation.
  2. Go through the list generated by dnf leaves above and reinstall all the packages you may still need.
  3. With the information from rpm -Va and your backup of /etc, restore configuration for some of the software installed. Using a diff tool such as vimdiff (not that easy to learn) or meld (not suitable for root access) may help you. Systemd units need special handling: You can enable/disable them through systemctl creating the symlinks instead of creating them by hand. It is important to restore files like /etc/shadow to make sure that users still have the same name and ID, otherwise you will run into massive permissions problems.
  4. Reinstall or restore your stuff to /opt and possibly other stuff in /var
  5. If /home is on a separate partition, modify /etc/fstab accordingly to mount it, then reboot. If /home is not on a separate partition, restore the contents of /home from your backup. It is very important that you do this step after restoring /etc/shadow.
  6. For each user account, you may need to restore the dconf database. This is not likely, but check back if your configuration has been kept or removed to defaults.
  7. Make sure your SELinux labels are ok. Run fixfiles onboot as root or with sudo to make SELinux relabel all the filesystem on next boot (this will take a while).

This guide was created with a little help from answer to question 51259, an AskUbuntu answer and older tips I cannot remember where they came from.

EDIT 1: Added "Preparation" section. Added more details on which partitions to wipe and which to keep. Added step 7 below "Restoring".

Preparation

  • Make sure that you have enough space for backing up all your disk
  • Check the "Common bugs" page for the new Fedora release, e.g. for Fedora 28 for any issues. If you are planning to install an unstable release or a version just released a few days ago, check the Blocker bugs for critical bugs which may affect you.

Backup

First, you need to carefully make a backup.

  1. Save the list of installed packages (rpm -qa) just in case.¹
  2. Save the list of manually installed packages (dnf leaves using the dnf leaves plugin). This will be needed later if you want to reinstall all the extra packages you've installed before.¹
  3. For every user installed, take a copy of the dconf database running dconf dump / as their user ID.¹
  4. Create a copy of /etc. Do this as root or with sudo because otherwise you will be missing important files due to missing permissions. This will backup system-wide configuration.²
  5. Take a backup of a list of all enabled systemd units using systemctl list-unit-files | grep enabled
  6. If you have /opt, make a backup too.²
  7. If you are interested in keeping logs, etc., or are using a web server, backup the relevant parts of /var too. This is not normally needed.
  8. Backup the output of rpm -Va. Have a look at this list as it will contain all files which differ from package defaults. This is especially important for config files which may reside outside of /etc, but also for permissions.
  9. Take a full backup of /home.³ If it is on a separate partition, take an image, e.g. by using GNOME disks or dd (dangerous). If it is not on a separate partition, consider putting it on a separate partition as this will ease future reinstallations. If you don't have a separate partition, then carefully back-up your /home and store it useing tar or cp -a ... to ensure the permissions of all files remain unchanged when you restore.
  10. Take a full image (backup) of all disk(s) connected to that computer just in case anything goes wrong.
  11. Have a look at the backups to make sure that they actually work. If the backup failed (e.g. corrupted data) and you rely on it, you have a problem (or several problems).

¹: Do this from the currently running system or through a chroot environment from a live image. ²: Do this either from the currently running system or a live image. ³: Do this from a live image, not from the running system! Otherwise file modifications will be lost. You may also get problems with permissions.

Fedora installation

Boot from any installer media and do a full installation, wiping the root partition. You do not have to wipe a separate /home partition. You need to wipe any partition containing the boot manager (/boot) or the system-managed folders below /usr. If you have a separate partition for /var, you probably should wipe it too, the same is true for /etc.

If you are using LVM, a RAID, a LUKS container or a btrfs multi-disk layout, you do not need to remove these. Just remove and re-create the partitions (or subvolumes in case of btrfs) as described above. If you are using a LUKS container in post-2018, I recommend you remove and regenrate it using the LUKS2 layout for improved security.

Restoring configuration

  1. Boot into the new installation.
  2. Go through the list generated by dnf leaves above and reinstall all the packages you may still need.
  3. With the information from rpm -Va and your backup of /etc, restore configuration for some of the software installed. Using a diff tool such as vimdiff (not that easy to learn) or meld (not suitable for root access) may help you. Systemd units need special handling: You can enable/disable them through systemctl creating the symlinks instead of creating them by hand. It is important to restore files like /etc/shadow to make sure that users still have the same name and ID, otherwise you will run into massive permissions problems.
  4. Reinstall or restore your stuff to /opt and possibly other stuff in /var
  5. If /home is on a separate partition, modify /etc/fstab accordingly to mount it, then reboot. If /home is not on a separate partition, restore the contents of /home from your backup. It is very important that you do this step after restoring /etc/shadow.
  6. For each user account, you may need to restore the dconf database. This is not likely, but check back if your configuration has been kept or removed to defaults.
  7. Make sure your SELinux labels are ok. Run fixfiles onboot as root or with sudo to make SELinux relabel all the filesystem on next boot (this will take a while).

This guide was created with a little help from answer to question 51259, an AskUbuntu answer, the Fedora Wiki and older tips I cannot remember where they came from.

EDIT 1: Added "Preparation" section. Added more details on which partitions to wipe and which to keep. Added step 7 below "Restoring".

Preparation

  • Make sure that you have enough space for backing up all your disk
  • Check the "Common bugs" page for the new Fedora release, e.g. for Fedora 28 for any issues. If you are planning to install an unstable release or a version just released a few days ago, check the Blocker bugs for critical bugs which may affect you.

Backup

First, you need to carefully make a backup.

  1. Save the list of installed packages (rpm -qa) just in case.¹
  2. Save the list of manually installed packages (dnf leaves using the dnf leaves plugin). This will be needed later if you want to reinstall all the extra packages you've installed before.¹
  3. For every user installed, take a copy of the dconf database running dconf dump / as their user ID.¹
  4. Create a copy of /etc. Do this as root or with sudo because otherwise you will be missing important files due to missing permissions. This will backup system-wide configuration.²
  5. Take a backup of a list of all enabled systemd units using systemctl list-unit-files | grep enabled
  6. If you have /opt or files in /usr/local, make a backup too.²
  7. If you are interested in keeping logs, etc., or are using a web server, backup the relevant parts of /var too. This is not normally needed.
  8. Backup the output of rpm -Va. Have a look at this list as it will contain all files which differ from package defaults. This is especially important for config files which may reside outside of /etc, but also for permissions.
  9. Take a full backup of /home.³ If it is on a separate partition, take an image, e.g. by using GNOME disks or dd (dangerous). If it is not on a separate partition, consider putting it on a separate partition as this will ease future reinstallations. If you don't have a separate partition, then carefully back-up your /home and store it useing tar or cp -a ... to ensure the permissions of all files remain unchanged when you restore.
  10. Take a full image (backup) of all disk(s) connected to that computer just in case anything goes wrong.
  11. Have a look at the backups to make sure that they actually work. If the backup failed (e.g. corrupted data) and you rely on it, you have a problem (or several problems).

¹: Do this from the currently running system or through a chroot environment from a live image. ²: Do this either from the currently running system or a live image. ³: Do this from a live image, not from the running system! Otherwise file modifications will be lost. You may also get problems with permissions.

Fedora installation

Boot from any installer media and do a full installation, wiping the root partition. You do not have to wipe a separate /home partition. You need to wipe any partition containing the boot manager (/boot) or the system-managed folders below /usr. If you have a separate partition for /var, you probably should wipe it too, the same is true for /etc.

If you are running a multi-boot system, the EFI system partition /boot/efi should be preserved, unless you are sure it contains nothing coming from other OS installations.

If you are using LVM, a RAID, a LUKS container or a btrfs multi-disk layout, you do not need to remove these. Just remove and re-create the partitions (or subvolumes in case of btrfs) as described above. If you are using a LUKS container in post-2018, I recommend you remove and regenrate it using the LUKS2 layout for improved security.

Restoring configuration

  1. Boot into the new installation.
  2. Go through the list generated by dnf leaves above and reinstall all the packages you may still need.
  3. With the information from rpm -Va and your backup of /etc, restore configuration for some of the software installed. Using a diff tool such as vimdiff (not that easy to learn) or meld (not suitable for root access) may help you. Systemd units need special handling: You can enable/disable them through systemctl creating the symlinks instead of creating them by hand. It is important to restore files like /etc/shadow, /etc/group and /etc/passwd to make sure that users still have the same name and ID, otherwise you will run into massive permissions problems.problems. Note that some of the groups or users may be missing or added on the new installation depending on the packages you installed.
  4. Reinstall or restore your stuff to /opt, /usr/local and possibly other stuff in /var
  5. If /home is on a separate partition, modify /etc/fstab accordingly to mount it, then reboot. If /home is not on a separate partition, restore the contents of /home from your backup. It is very important that you do this step after restoring /etc/shadow.
  6. For each user account, you may need to restore the dconf database. This is not likely, but check back if your configuration has been kept or removed to defaults.
  7. Make sure your SELinux labels are ok. Run fixfiles onboot as root or with sudo to make SELinux relabel all the filesystem on next boot (this will take a while).

This guide was created with a little help from answer to question 51259, an AskUbuntu answer, the Fedora Wiki , the user comments below and older tips I cannot remember where they came from.

EDIT 1: Added "Preparation" section. Added more details on which partitions to wipe and which to keep. Added step 7 below "Restoring".

EDIT 2: Added comment for multi-boot EFI system partition. Add details on /etc/shadow, /etc/group, /etc/passwd. Handle /usr/local just like /opt.

Preparation

  • Make sure that you have enough space for backing up all your disk
  • Check the "Common bugs" page for the new Fedora release, e.g. for Fedora 28 for any issues. If you are planning to install an unstable release or a version just released a few days ago, check the Blocker bugs for critical bugs which may affect you.

Backup

First, you need to carefully make a backup.

  1. Save the list of installed packages (rpm -qa) just in case.¹
  2. Save the list of manually installed packages (dnf leaves using the dnf leaves plugin). This will be needed later if you want to reinstall all the extra packages you've installed before.¹
  3. For every user installed, take a copy of the dconf database running dconf dump / as their user ID.¹
  4. Create a copy of /etc. Do this as root or with sudo because otherwise you will be missing important files due to missing permissions. This will backup system-wide configuration.²
  5. Take a backup of a list of all enabled systemd units using systemctl list-unit-files | grep enabled
  6. If you have /opt or files in /usr/local, make a backup too.²
  7. If you are interested in keeping logs, etc., or are using a web server, backup the relevant parts of /var too. This is not normally needed.
  8. Backup the output of rpm -Va. Have a look at this list as it will contain all files which differ from package defaults. This is especially important for config files which may reside outside of /etc, but also for permissions.
  9. Take a full backup of /home.³ If it is on a separate partition, take an image, e.g. by using GNOME disks or dd (dangerous). If it is not on a separate partition, consider putting it on a separate partition as this will ease future reinstallations. If you don't have a separate partition, then carefully back-up your /home and store it useing tar or cp -a ... to ensure the permissions of all files remain unchanged when you restore.
  10. Take a full image (backup) of all disk(s) connected to that computer just in case anything goes wrong.
  11. Have a look at the backups to make sure that they actually work. If the backup failed (e.g. corrupted data) and you rely on it, you have a problem (or several problems).

¹: Do this from the currently running system or through a chroot environment from a live image. ²: Do this either from the currently running system or a live image. ³: Do this from a live image, not from the running system! Otherwise file modifications will be lost. You may also get problems with permissions.

Fedora installation

Boot from any installer media and do a full installation, wiping the root partition. You do not have to wipe a separate /home partition. You need to wipe any partition containing the boot manager (/boot) or the system-managed folders below /usr. If you have a separate partition for /var, you probably should wipe it too, the same is true for /etc.

If you are running a multi-boot system, the EFI system partition /boot/efi should be preserved, unless you are sure it contains nothing coming from other OS installations.

If you are using LVM, a RAID, a LUKS container or a btrfs multi-disk layout, you do not need to remove these. Just remove and re-create the partitions (or subvolumes in case of btrfs) as described above. If you are using a LUKS container in post-2018, I recommend you remove and regenrate it using the LUKS2 layout for improved security.

Restoring configuration

  1. Boot into the new installation.
  2. Go through the list generated by dnf leaves above and reinstall all the packages you may still need.
  3. With the information from rpm -Va and your backup of /etc, restore configuration for some of the software installed. Using a diff tool such as vimdiff (not that easy to learn) or meld (not suitable for root access) may help you. Systemd units need special handling: You can enable/disable them through systemctl creating the symlinks instead of creating them by hand. It is important to restore files like /etc/shadow, /etc/group and /etc/passwd to make sure that users still have the same name and ID, otherwise you will run into massive permissions problems. Note that some of the groups or users may be missing or added on the new installation depending on the packages you installed.
  4. Reinstall or restore your stuff to /opt, /usr/local and possibly other stuff in /var
  5. If /home is on a separate partition, modify /etc/fstab accordingly to mount it, then reboot. If /home is not on a separate partition, restore the contents of /home from your backup. It is very important that you do this step after restoring /etc/shadow.
  6. For each user account, you may need to restore the dconf database. This is not likely, but check back if your configuration has been kept or removed to defaults.
  7. Make sure your SELinux labels are ok. Run fixfiles onboot as root or with sudo to make SELinux relabel all the filesystem on next boot (this will take a while).

This guide was created with help from answer to question 51259, an AskUbuntu answer, the Fedora Wiki, the user comments below (most notably @villykruse) and older tips I cannot remember where they came from.

EDIT 1: Added "Preparation" section. Added more details on which partitions to wipe and which to keep. Added step 7 below "Restoring".

EDIT 2: Added comment for multi-boot EFI system partition. Add details on /etc/shadow, /etc/group, /etc/passwd. Handle /usr/local just like /opt. .

Preparation

  • Make sure that you have enough space for backing up all your disk
  • Check the "Common bugs" page for the new Fedora release, e.g. for Fedora 28 for any issues. If you are planning to install an unstable release or a version just released a few days ago, check the Blocker bugs for critical bugs which may affect you.

Backup

First, you need to carefully make a backup.

  1. Save the list of installed packages (rpm -qa) just in case.¹
  2. Save the list of manually installed packages (dnf leaves using the dnf leaves plugin). This will be needed later if you want to reinstall all the extra packages you've installed before.¹
  3. For every user installed, take a copy of the dconf database running dconf dump / as their user ID.¹
  4. Create a copy of /etc. Do this as root or with sudo because otherwise you will be missing important files due to missing permissions. This will backup system-wide configuration.²
  5. Take a backup of a list of all enabled systemd units using systemctl list-unit-files | grep enabled
  6. If you have /opt or files in /usr/local, make a backup too.²
  7. If you are interested in keeping logs, etc., or are using a web server, backup the relevant parts of /var too. This is not normally needed.
  8. Backup the output of rpm -Va. Have a look at this list as it will contain all files which differ from package defaults. This is especially important for config files which may reside outside of /etc, but also for permissions.
  9. Take a full backup of /home.³ If it is on a separate partition, take an image, e.g. by using GNOME disks or dd (dangerous). If it is not on a separate partition, consider putting it on a separate partition as this will ease future reinstallations. If you don't have a separate partition, then carefully back-up your /home and store it useing tar or cp -a ... to ensure the permissions of all files remain unchanged when you restore.
  10. Take a full image (backup) of all disk(s) connected to that computer just in case anything goes wrong.
  11. Have a look at the backups to make sure that they actually work. If the backup failed (e.g. corrupted data) and you rely on it, you have a problem (or several problems).

¹: Do this from the currently running system or through a chroot environment from a live image. ²: Do this either from the currently running system or a live image. ³: Do this from a live image, not from the running system! Otherwise file modifications will be lost. You may also get problems with permissions.

Fedora installation

Boot from any installer media and do a full installation, wiping the root partition. You do not have to wipe a separate /home partition. You need to wipe any partition containing the boot manager (/boot) or the system-managed folders below /usr. If you have a separate partition for /var, you probably should wipe it too, the same is true for /etc.

If you are running a multi-boot system, the EFI system partition /boot/efi should be preserved, unless you are sure it contains nothing coming from other OS installations.

If you are using LVM, a RAID, a LUKS container or a btrfs multi-disk layout, you do not need to remove these. Just remove and re-create the partitions (or subvolumes in case of btrfs) as described above. If you are using a LUKS container in post-2018, I recommend you remove and regenrate it using the LUKS2 layout for improved security.

Restoring configuration

  1. Boot into the new installation.
  2. Go through the list generated by dnf leaves above and reinstall all the packages you may still need.
  3. With the information from rpm -Va and your backup of /etc, restore configuration for some of the software installed. Using a diff tool such as vimdiff (not that easy to learn) or meld (not suitable for root access) may help you. Systemd units need special handling: You can enable/disable them through systemctl creating the symlinks instead of creating them by hand. It is important to restore files like /etc/shadow, /etc/group and /etc/passwd to make sure that users still have the same name and ID, otherwise you will run into massive permissions problems. Note that some of the groups or users may be missing or added on the new installation depending on the packages you installed.installed. Use a diff too here too.
  4. Reboot to make sure that user ID changes are applied.
  5. Reinstall or restore your stuff to /opt, and /usr/local . Compiling from source and reinstalling is preferred because there may be ABI/API changes.
  6. Restore possibly other stuff in /var if necessary.
  7. If /home is on a separate partition, modify /etc/fstab accordingly to mount it, then reboot. If /home is not on a separate partition, restore the contents of /home from your backup. It is very important that you do this step after restoring /etc/shadow.
  8. For each user account, you may need to restore the dconf database. This is not likely, but check back if your configuration has been kept or removed to defaults.
  9. Make sure your SELinux labels are ok. Run fixfiles onboot as root or with sudo to make SELinux relabel all the filesystem on next boot (this will take a while).

This guide was created with help from answer to question 51259, an AskUbuntu answer, the Fedora Wiki, the user comments below (most notably @villykruse) and older tips I cannot remember where they came from.

EDIT 1: Added "Preparation" section. Added more details on which partitions to wipe and which to keep. Added step 7 below "Restoring".

EDIT 2: Added comment for multi-boot EFI system partition. Add details on /etc/shadow, /etc/group, /etc/passwd. Handle /usr/local just like /opt.