我可以安全地删除 Ubuntu 12.04 分区并为我的 Elementary OS 使用未分配的空间吗?

我可以安全地删除 Ubuntu 12.04 分区并为我的 Elementary OS 使用未分配的空间吗?

我有这个设置:

图像

我决定改用 Elementary OS Luna(Ubuntu 12.04 的分支)作为我的主要 Linux 发行版。现在我需要删除 Ubuntu 分区,以便为只有 10Gb 的 eOS 添加容量。

目前我的 eOS 是/dev/sda9,Ubuntu 是/dev/sda8/.我忘记了引导加载程序安装在哪里,所以我运行了 bootinfoscript,它返回了以下内容:

`============================== 启动信息摘要:================ ===============

=> Grub2 (v1.99) 安装在 /dev/sda 的 MBR 中,并在同一硬盘驱动器的扇区 1 中查找 core.img。 core.img 位于此位置,并在分区 94 中查找 .

sda1: __________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7: NTFS
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  
Boot files:        /bootmgr /Boot/BCD

sda2: __________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7: NTFS
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  Windows 7
Boot files:        /bootmgr /Boot/BCD /Windows/System32/winload.exe

sda3: __________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7: NTFS
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  
Boot files:        /bootmgr /boot/bcd

sda4: __________________________________________________________________________

File system:       Extended Partition
Boot sector type:  -
Boot sector info: 

sda5: __________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7: NTFS
Boot sector info:  According to the info in the boot sector, sda5 starts 
                   at sector 2048.
Operating System:  
Boot files:        

sda6: __________________________________________________________________________

File system:       swap
Boot sector type:  -
Boot sector info: 

sda7: __________________________________________________________________________

File system:       ext4
Boot sector type:  Grub2 (v1.99)
Boot sector info:  Grub2 (v1.99) is installed in the boot sector of sda7 
                   and looks at sector 851823520 of the same hard drive 
                   for core.img, but core.img can not be found at this 
                   location.
Operating System:  
Boot files:        /grub/grub.cfg /extlinux/extlinux.conf

sda8: __________________________________________________________________________

File system:       ext4
Boot sector type:  Grub2 (v1.99)
Boot sector info:  Grub2 (v1.99) is installed in the boot sector of sda8 
                   and looks at sector 860224256 of the same hard drive 
                   for core.img. core.img is at this location and looks 
                   for (,msdos9)/boot/grub on this drive.
Operating System:  Ubuntu 13.04
Boot files:        /etc/fstab

sda9: __________________________________________________________________________

File system:       ext4
Boot sector type:  -
Boot sector info: 
Operating System:  elementary OS Luna
Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img`

我需要有关如何进行的建议。我的意思是,删除 Ubuntu 和 /dev/sda7/ 分区不会弄乱我的 GRUB 吗?请帮忙,谢谢。

答案1

一般来说,您没有理由不能删除 Ubuntu 分区或在其上安装 Elementary OS。

在绝大多数情况下,Linux 发行版会尝试检测所有可用的操作系统安装(包括来自华盛顿州雷蒙德的有缺陷、过时的产品),根据检测到的安装构建启动菜单,然后将 GRUB 安装到启动驱动器的 MBR。因此,您的 GRUB 引导菜单大概当您安装 Elementary OS 时,将会从头开始重建。

如果 Elementary OS 安装失败(更准确地说,如果在尝试安装 GRUB 之前失败),假设您没有移动或调整任何其他分区的大小,您仍然应该能够使用引导块中剩余的 GRUB 配置引导到其他分区。

附录:@d4ryl3 通过询问澄清了他的问题:“删除 Ubuntu 和 /dev/sda7/ 分区不会弄乱我的 GRUB 吗?”答案是:“大概不是。”

这取决于最后安装 GRUB 的人、如何配置 GRUB 来查找分区以及您希望如何对磁盘进行重新分区。如果 GRUB 配置为查找卷 ID 或卷标签,那么您可能会没事,因为当分区移动时,卷 ID 通常不会改变,而卷标签肯定不会改变(除非您明确这样做)。

如果 OTOH GRUB 配置为查找“原始”分区号,那么您仍然会大概好好地。例如,/dev/sda7 被称为 /dev/sda7,因为它是 MBR 中分区表中的第七个条目。 “删除”分区通常表示将分区条目标记为无效或隐藏;它通常并不意味着将所有后续条目向上移动以填充已删除的条目,因为这样做会导致所有这些条目获得新的分区号。如果分区号发生更改,则应重新运行 GRUB 安装,以便它知道最新的分区几何形状。

如果分区条目被移动,或者分区描述的数据块被移动,并且 GRUB 需要从数据块原来所在的位置移出一些东西,那么您可能会受到严重影响。在你的情况下,这两种情况都不可能发生。但是,您尚未描述如何对磁盘进行重新分区,这可能会影响结果。

重新分区后您可能应该注意做两件事重新启动:

  • 重新运行系统实用程序来检测所有操作系统分区并将 GRUB 重新安装到 MBR。
  • 创建一个带有 GRUB 的可启动 USB 记忆棒,这样您就有一半的机会修复任何损坏。

相关内容