如何在双系统引导下替换 Linux 发行版
双引导

> 
> 在双系统引导的状态下，你可以将已安装的 Linux 发行版替换为另一个发行版，同时还可以保留原本的个人数据。
> 
> 
> 


![How to Replace One Linux Distribution With Another From Dual Boot](/data/attachment/album/201810/21/002240jg0d00rl4devsllr.png)


假设你的电脑上已经[以双系统的形式安装了 Ubuntu 和 Windows](https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/)，但经过[将 Linux Mint 与 Ubuntu 比较](https://itsfoss.com/linux-mint-vs-ubuntu/)之后，你又觉得 [Linux Mint](https://www.linuxmint.com/) 会更适合自己的时候，你会怎样做？又该如何在[删除 Ubuntu](https://itsfoss.com/uninstall-ubuntu-linux-windows-dual-boot/) 的同时[在双系统中安装 Mint](https://itsfoss.com/guide-install-linux-mint-16-dual-boot-windows/) 呢？


你或许觉得应该首先从在双系统中卸载 [Ubuntu](https://www.ubuntu.com/)，然后使用 Linux Mint 重新安装成双系统。但实际上并不需要这么麻烦。


如果你已经在双系统引导中安装了一种 Linux 发行版，就可以轻松替换成另一个发行版了，而且也不必卸载已有的 Linux 发行版，只需要删除其所在的分区，然后在腾出的磁盘空间上安装另一个 Linux 发行版就可以了。


与此同时，更换 Linux 发行版后，仍然会保留原本 home 目录中包含所有文件。


下面就来详细介绍一下。


### 在双系统引导中替换 Linux 发行版


<https://youtu.be/ptF2RUehbKs>


这是我的演示范例。我使用双系统引导同时安装了 Windows 10 和 Linux Mint 19，然后我会把 Linux Mint 19 替换成 Elementary OS 5，同时在替换后保留我的个人文件（包括音乐、图片、视频和 home 目录中的文件）。


你需要做好以下这些准备：


* 使用 Linux 和 Windows 双系统引导
* 需要安装的 Linux 发行版的 USB live 版
* 在外部磁盘备份 Windows 和 Linux 中的重要文件（并非必要，但建议备份一下）


#### 在替换 Linux 发行版时要记住保留你的 home 目录


如果想让个人文件在安装新 Linux 系统的过程中不受影响，原有的 Linux 系统必须具有单独的 root 目录和 home 目录。你可能会发现我的[双系统引导教程](https://itsfoss.com/guide-install-elementary-os-luna/)在安装过程中不选择“与 Windows 共存”选项，而选择“其它”选项，然后手动创建 root 和 home 分区。所以，手动创建单独的 home 分区也算是一个磨刀不误砍柴工的操作。因为如果要在不丢失文件的情况下，将现有的 Linux 发行版替换为另一个发行版，需要将 home 目录存放在一个单独的分区上。


不过，你必须记住现有 Linux 系统的用户名和密码才能使用与新系统中相同的 home 目录。


如果你没有单独的 home 分区，也可以后续再进行创建。但这并不是推荐做法，因为这个过程会比较复杂，有可能会把你的系统搞乱。


下面来看看如何替换到另一个 Linux 发行版。


#### 步骤 1：为新的 Linux 发行版创建一个 USB live 版


尽管上文中已经提到了它，但我还是要重复一次以免忽略。


你可以使用 Windows 或 Linux 中的启动盘创建器（例如 [Etcher](https://etcher.io/)）来创建 USB live 版，这个过程比较简单，这里不再详细叙述。


#### 步骤 2：启动 USB live 版并安装 Linux


你应该已经使用过双系统启动，对这个过程不会陌生。使用 USB live 版重新启动系统，在启动时反复按 F10 或 F12 进入 BIOS 设置。选择从 USB 启动，就可以看到进入 live 环境或立即安装的选项。


在安装过程中，进入“安装类型”界面时，选择“其它”选项。


![Replacing one Linux with another from dual boot](/data/attachment/album/201810/21/002240leyy1hfcyvl3yuoz.jpg)


*在这里选择“其它”选项*


#### 步骤 3：准备分区操作


下图是分区界面。你会看到使用 Ext4 文件系统类型来安装 Linux。


![Identifying Linux partition in dual boot](/data/attachment/album/201810/21/002242kuv11f1hafmhzunm.jpg)


*确定 Linux 的安装位置*


在上图中，标记为 Linux Mint 19 的 Ext4 分区是 root 分区，大小为 82691 MB 的第二个 Ext4 分区是 home 分区。在这里我这里没有使用[交换空间](https://itsfoss.com/swap-size/)。


如果你只有一个 Ext4 分区，就意味着你的 home 目录与 root 目录位于同一分区。在这种情况下，你就无法保留 home 目录中的文件了，这个时候我建议将重要文件复制到外部磁盘，否则这些文件将不会保留。


然后是删除 root 分区。选择 root 分区，然后点击 `-` 号，这个操作释放了一些磁盘空间。


![Delete root partition of your existing Linux install](/data/attachment/album/201810/21/002244q77ewwjk6qsmkqgk.jpg)


*删除 root 分区*


磁盘空间释放出来后，点击 `+` 号。


![Create root partition for the new Linux](/data/attachment/album/201810/21/002246gfbvj66nzjeepzzq.jpg)


*创建新的 root 分区*


现在已经在可用空间中创建一个新分区。如果你之前的 Linux 系统中只有一个 root 分区，就应该在这里创建 root 分区和 home 分区。如果需要，还可以创建交换分区。


如果你之前已经有 root 分区和 home 分区，那么只需要从已删除的 root 分区创建 root 分区就可以了。


![Create root partition for the new Linux](/data/attachment/album/201810/21/002248dovkgofjjx1xzxdf.jpg)


*创建 root 分区*


你可能有疑问，为什么要经过“删除”和“添加”两个过程，而不使用“更改”选项。这是因为以前使用“更改”选项好像没有效果，所以我更喜欢用 `-` 和 `+`。这是迷信吗？也许是吧。


这里有一个重要的步骤，对新创建的 root 分区进行格式化。在没有更改分区大小的情况下，默认是不会对分区进行格式化的。如果分区没有被格式化，之后可能会出现问题。


![](/data/attachment/album/201810/21/002249izf61ww2gxxfwtgx.jpg)


*格式化 root 分区很重要*


如果你在新的 Linux 系统上已经划分了单独的 home 分区，选中它并点击更改。


![Recreate home partition](/data/attachment/album/201810/21/002251frjrlu4gzgwqjfua.jpg)


*修改已有的 home 分区*


然后指定将其作为 home 分区挂载即可。


![Specify the home mount point](/data/attachment/album/201810/21/002253bgtk5tq65qah5a17.jpg)


*指定 home 分区的挂载点*


如果你还有交换分区，可以重复与 home 分区相同的步骤，唯一不同的是要指定将空间用作交换空间。


现在的状态应该是有一个 root 分区（将被格式化）和一个 home 分区（如果需要，还可以使用交换分区）。点击“立即安装”可以开始安装。


![Verify partitions while replacing one Linux with another](/data/attachment/album/201810/21/002255mmwffwzw5mcmfwhh.jpg)


*检查分区情况*


接下来的几个界面就很熟悉了，要重点注意的是创建用户和密码的步骤。如果你之前有一个单独的 home 分区，并且还想使用相同的 home 目录，那你必须使用和之前相同的用户名和密码，至于设备名称则可以任意指定。


![To keep the home partition intact, use the previous user and password](/data/attachment/album/201810/21/002258arnaq6qcu6eeka6f.jpg)


*要保持 home 分区不变，请使用之前的用户名和密码*


接下来只要静待安装完成，不需执行任何操作。


![Wait for installation to finish](/data/attachment/album/201810/21/002300avt79y77711hp79h.jpg)


*等待安装完成*


安装完成后重新启动系统，你就能使用新的 Linux 发行版。


在以上的例子中，我可以在新的 Linux Mint 19 中使用原有的 Elementary OS 中的整个 home 目录，并且其中所有视频和图片都原封不动。岂不美哉？




---


via: <https://itsfoss.com/replace-linux-from-dual-boot/>


作者：[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[HankChow](https://github.com/HankChow) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

Suppose you managed to [successfully dual boot Ubuntu and Windows](https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/). But after reading the [Linux Mint versus Ubuntu discussion](https://itsfoss.com/linux-mint-vs-ubuntu/), you realized that [Linux Mint](https://www.linuxmint.com/?ref=itsfoss.com) is more suited for your needs. What would you do now? How would you [remove Ubuntu](https://itsfoss.com/uninstall-ubuntu-linux-windows-dual-boot/) and [install Mint in dual boot](https://itsfoss.com/guide-install-linux-mint-16-dual-boot-windows/)?

You might think that you need to uninstall [Ubuntu](https://www.ubuntu.com/?ref=itsfoss.com) from dual boot first and then repeat the dual booting steps with Linux Mint. Let me tell you something. You don’t need to do all of that.

If you already have a Linux distribution installed in dual boot, you can easily replace it with another. You simply delete its partition and install the new distribution on the disk space vacated by the previous distribution.

Another good news is that you *may* be able to keep your Home directory with all your documents and pictures while switching the Linux distributions.

Let me show you how to switch Linux distributions.

## Replace one Linux with another from dual boot

Let me describe the scenario I am going to use here. I have Linux Mint 19 installed on my system in dual boot mode with Windows 10. I am going to replace it with elementary OS 5. I’ll also keep my personal files (music, pictures, videos, documents from my home directory) while switching distributions.

Let’s first take a look at the requirements:

- A system with Linux and Windows dual boot
- Live USB of Linux you want to install
- Backup of your important files in Windows and in Linux on an external disk (optional yet recommended)

### Things to keep in mind for keeping your home directory while changing Linux distribution

If you want to keep your files from existing Linux install as it is, you must have a separate root and home directory. You might have noticed that in my [dual boot tutorials](https://itsfoss.com/guide-install-elementary-os-luna/), I always go for ‘Something Else’ option and then manually create root and home partitions instead of choosing ‘Install alongside Windows’ option. This is where all the troubles in manually creating separate home partition pay off.

Keeping Home on a separate partition is helpful in situations when you want to replace your existing Linux install with another without losing your files.

Note: You must remember the exact username and password of your existing Linux install in order to use the same home directory as it is in the new distribution.

If you don’t have a separate Home partition, you may create it later as well BUT I won’t recommend that. That process is slightly complicated and I don’t want you to mess up your system.

With that much background information, it’s time to see how to replace a Linux distribution with another.

### Step 1: Create a live USB of the new Linux distribution

Alright! I already mentioned it in the requirements but I still included it in the main steps to avoid confusion.

You can create a live USB using a start up disk creator like [Etcher](https://etcher.io/?ref=itsfoss.com) in Windows or Linux. The process is simple so I am not going to list the steps here.

### Step 2: Boot into live USB and proceed to installing Linux

Since you have already dual booted before, you probably know the drill. Plugin the live USB, restart your system and at the boot time, press F10 or F12 repeatedly to enter BIOS settings.

In here, choose to boot from the USB. And then you’ll see the option to try the live environment or installing it immediately.

You should start the installation procedure. When you reach the ‘Installation type’ screen, choose the ‘Something else’ option.

![Replacing one Linux with another from dual boot](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-1.jpg)

### Step 3: Prepare the partition

You’ll see the partitioning screen now. Look closely and you’ll see your Linux installation with Ext4 file system type.

![Identifying Linux partition in dual boot](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-2.jpg)

In the above picture, the Ext4 partition labeled as Linux Mint 19 is the root partition. The second Ext4 partition of 82691 MB is the Home partition. I [haven’t used any swap space](https://itsfoss.com/swap-size/) here.

Now, if you have just one Ext4 partition, that means that your home directory is on the same partition as root. In this case, you won’t be able to keep your Home directory. I suggest that you copy the important files to an external disk else you’ll lose them forever.

It’s time to delete the root partition. Select the root partition and click the – sign. This will create some free space.

![Delete root partition of your existing Linux install](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-3.jpg)

When you have the free space, click on + sign.

![Create root partition for the new Linux](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-4.jpg)

Now you should create a new partition out of this free space. If you had just one root partition in your previous Linux install, you should create root and home partitions here. You can also create the swap partition if you want to.

If you had root and home partition separately, just create a root partition from the deleted root partition.

![Create root partition for the new Linux](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-5.jpg)

You may ask why did I use delete and add instead of using the ‘change’ option. It’s because a few years ago, using change didn’t work for me. So I prefer to do a – and +. Is it superstition? Maybe.

One important thing to do here is to mark the newly created partition for format. f you don’t change the size of the partition, it won’t be formatted unless you explicitly ask it to format. And if the partition is not formatted, you’ll have issues.

![](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-6.jpg)

Now if you already had a separate Home partition on your existing Linux install, you should select it and click on change.

![Recreate home partition](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-7.jpg)

You just have to specify that you are mounting it as home partition.

![Specify the home mount point](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-8.jpg)

If you had a swap partition, you can repeat the same steps as the home partition. This time specify that you want to use the space as swap.

At this stage, you should have a root partition (with format option selected) and a home partition (and a swap if you want to). Hit the install now button to start the installation.

![Verify partitions while replacing one Linux with another](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-9.jpg)

The next few screens would be familiar to you. What matters is the screen where you are asked to create user and password.

If you had a separate home partition previously and you want to use the same home directory, you MUST use the same username and password that you had before. Computer name doesn’t matter.

![To keep the home partition intact, use the previous user and password](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-10.jpg)

Your struggle is almost over. You don’t have to do anything else other than waiting for the installation to finish.

![Wait for installation to finish](https://itsfoss.com/content/images/wordpress/2018/09/replace-linux-with-another-11.jpg)

Once the installation is over, restart your system. You’ll have a new Linux distribution or version.

In my case, I had the entire home directory of Linux Mint 19 as it is in the elementary OS. All the videos, pictures I had remained as it is. Isn’t that nice?