Board logo

標題: [操作疑難] 請問這樣分配磁碟是不是有點問題? [打印本頁]

作者: finfin    時間: 2025-5-27 12:44     標題: 請問這樣分配磁碟是不是有點問題?

下面的圖是我安裝linux LMDE 6 的磁碟分配,
這部腦是windows 11 and Linux 獨立安裝的,
不是用VM。
問題:
1.裏面有windows 的fat 32 EFI partition,及 linux 的 fat 32 EFI partition /boot/efi,
咁樣有無問題?
2.而linux 自己再有一個ext 4的EFI partition 同/boot/efi 分開應該嗎?
還是只開一個/boot/efi 總容量加埋成為1313MB就可以?

我要咁大個boot partition,係因為之前出過呢個帖所出現嘅問題。
所以比大啲佢。

[attach]2480196[/attach]
[attach]2480197[/attach]
[attach]2480198[/attach]

唔該晒。
作者: erickleung    時間: 2025-5-27 16:31

Windows 11boot? 封禁了Linux dual boot. 好似大半年後才肯修補. 用VMware workstation pro(現可免費使用). 其實完全轉Linux 吧.  舊機要用BIOS開機. 新機才用你上面的以UEFI開機. 若用VMware自設BIOS, 但可自行設定UEFI才装Linux
作者: s84292    時間: 2025-5-27 17:47

本帖最後由 s84292 於 2025-5-27 09:49 編輯

你個LINUX 其實用黎做咩多
在WINDOWS 11內行WSL2 唔得咩? 唔洗搞咁多野

我多BOOTS一係就VHD,一係就單獨碟
混在同一隻碟煩好多
作者: ww9876    時間: 2025-5-27 20:13

fat32? 好似有size限制。

via HKEPC Reader for Android
作者: chancho    時間: 2025-5-27 23:40

windows and linux should share the same EFI partition. however, every time windows update itself will make linux unbootable. be aware.
作者: Okt04175    時間: 2025-5-28 13:24

其實Linux同Windows分開各自用一個分割區去放EFI Boot Loader係安全做法,好過放埋一齊一個唔小心又畀Windows啲爛更新整花Linux嗰EFI Boot Loader。
作者: chancho    時間: 2025-5-28 15:43

i never thought of how to use two efi to dual boot win and linux unless going into bios and select the partition manually.
作者: finfin    時間: 2025-5-31 00:03

Windows 11boot? 封禁了Linux dual boot. 好似大半年後才肯修補. 用VMware workstation pro(現可免費使用 ...
erickleung 發表於 2025-5-27 16:31



    我張底板係有UEFI呀,粒U又係 i15 gen 13添。
作者: finfin    時間: 2025-5-31 00:05

你個LINUX 其實用黎做咩多
在WINDOWS 11內行WSL2 唔得咩? 唔洗搞咁多野

我多BOOTS一係就VHD,一係就單獨碟
...
s84292 發表於 2025-5-27 17:47


其實我用linux多,windows只係作後備。我屋企其他腦都係單安裝linux, 只有呢部桌面機有windows.
作者: finfin    時間: 2025-5-31 00:10

windows and linux should share the same EFI partition. however, every time windows update itself wil ...
chancho 發表於 2025-5-27 23:40



    caused bootable issue after update windows?
it seems I never met this problem,
I installed 2 OS in this computer for a very long time.
作者: finfin    時間: 2025-5-31 00:11

其實Linux同Windows分開各自用一個分割區去放EFI Boot Loader係安全做法,好過放埋一齊一個唔小心又畀Windo ...
Okt04175 發表於 2025-5-28 13:24



    明白,所以我第一張圖咁樣安排就對了,是嗎?
作者: Okt04175    時間: 2025-5-31 14:07

明白,所以我第一張圖咁樣安排就對了,是嗎?
finfin 發表於 2025-5-31 00:11

啱架喇
作者: javacomhk    時間: 2025-6-1 01:41

Yes, Windows and Linux can share the same EFI System Partition (ESP) for dual booting, but as you’ve experienced, Windows updates can sometimes overwrite or modify the EFI partition in ways that break the Linux bootloader (e.g., GRUB). This is a common issue because Windows assumes it’s the only operating system and may overwrite bootloader configurations. However, it’s also possible to use separate EFI partitions for Windows and Linux to avoid this problem, though it requires careful setup. Below, I’ll explain how to address the issue of Windows updates breaking Linux and how to configure separate EFI partitions.

### Why Windows Updates Break Linux
Windows updates can interfere with the EFI partition in the following ways:
- **Overwriting the Bootloader**: Windows may replace the GRUB bootloader with its own boot manager (`bootmgfw.efi`) in the EFI partition’s boot order.
- **Changing EFI Boot Entries**: Windows updates can modify the EFI firmware’s boot entries, prioritizing Windows Boot Manager and removing or ignoring Linux’s entry.
- **Corrupting GRUB Configuration**: Updates might overwrite critical files in the EFI partition used by GRUB.

### Solutions to Prevent Windows Updates from Breaking Linux
Here are steps to mitigate the issue while keeping a single EFI partition, followed by instructions for setting up separate EFI partitions.

#### Option 1: Mitigate Issues with a Shared EFI Partition
1. **Backup GRUB Configuration**:
   - Before a Windows update, back up your GRUB configuration and EFI partition contents:
     ```bash
     sudo cp -r /boot/efi/EFI /backup/location
     sudo cp /boot/grub/grub.cfg /backup/location
     ```
   - This allows you to restore GRUB if Windows overwrites it.

2. **Reinstall GRUB After Windows Updates**:
   - If a Windows update breaks Linux booting, boot into a Linux live USB and reinstall GRUB:
     ```bash
     sudo mount /dev/sdXn /mnt  # Mount your Linux root partition
     sudo mount /dev/sdXY /mnt/boot/efi  # Mount the EFI partition
     sudo grub-install --boot-directory=/mnt/boot --efi-directory=/mnt/boot/efi
     sudo chroot /mnt
     update-grub
     ```
     Replace `/dev/sdXn` with your Linux root partition and `/dev/sdXY` with the EFI partition.

3. **Set GRUB as the Default Bootloader**:
   - Ensure GRUB is the first entry in the EFI boot order. You can do this from Linux using `efibootmgr`:
     ```bash
     sudo efibootmgr
     sudo efibootmgr -o XXXX,YYYY  # Set GRUB (e.g., BootOrder XXXX) as the first entry
     ```
     Replace `XXXX` with GRUB’s boot entry ID (found in `efibootmgr` output) and `YYYY` with Windows Boot Manager’s ID.

4. **Disable Windows Fast Startup**:
   - Fast Startup in Windows can interfere with the EFI partition. Disable it in Windows:
     - Go to Control Panel > Power Options > Choose what the power buttons do > Change settings that are currently unavailable.
     - Uncheck “Turn on fast startup.”
   - This prevents Windows from locking the EFI partition during shutdown.

5. **Use a Custom EFI Path for GRUB**:
   - Configure GRUB to use a non-standard EFI file path (e.g., `\EFI\grub\grubx64.efi` instead of `\EFI\BOOT\bootx64.efi`) to avoid Windows overwriting the default boot file:
     ```bash
     sudo grub-install --efi-directory=/boot/efi --bootloader-id=grub
     ```
   - Update the EFI firmware to prioritize this custom entry using `efibootmgr`.

6. **Limit Windows Updates’ Access to EFI**:
   - Some users report success by making the EFI partition read-only for Windows (though this is risky and may cause Windows update failures). This involves modifying permissions on the EFI partition, but it’s not recommended unless you’re advanced.

#### Option 2: Use Separate EFI Partitions for Windows and Linux
Yes, it’s possible to use separate EFI partitions for Windows and Linux, which can prevent Windows updates from affecting Linux’s bootloader. However, this setup is less common and requires careful configuration, as most UEFI firmware expects a single EFI partition. Here’s how to do it:

1. **Understand the Requirements**:
   - Your disk must have enough space for an additional EFI partition (100-300 MB is sufficient).
   - Your UEFI firmware must support booting from multiple EFI partitions on the same disk (most modern firmware does, but some may not).
   - You’ll need to manage boot entries carefully to ensure both operating systems are accessible.

2. **Create a Second EFI Partition**:
   - **Backup your data** before modifying partitions, as this can lead to data loss if done incorrectly.
   - Use a tool like `gparted` (from a Linux live USB) or `fdisk` to create a new EFI partition:
     ```bash
     sudo fdisk /dev/sdX
     ```
     - Create a new partition (e.g., `/dev/sdX2`) with type `EFI System` (code `ef00` in `fdisk`).
     - Format it as FAT32:
       ```bash
       sudo mkfs.vfat -F 32 /dev/sdX2
       ```
   - Mount the new EFI partition temporarily (e.g., `/mnt/efi2`).

3. **Install Linux Bootloader to the New EFI Partition**:
   - During Linux installation (or reinstallation), specify the new EFI partition (e.g., `/dev/sdX2`) as the target for GRUB:
     ```bash
     sudo grub-install --efi-directory=/mnt/efi2 --boot-directory=/boot
     ```
   - Update GRUB to detect both operating systems:
     ```bash
     sudo update-grub
     ```
   - Ensure the new EFI partition is mounted in `/etc/fstab` (e.g., mount `/dev/sdX2` to `/boot/efi2`).

4. **Update EFI Boot Entries**:
   - Use `efibootmgr` to add a boot entry for the new EFI partition:
     ```bash
     sudo efibootmgr -c -d /dev/sdX -p 2 -L "Linux" -l "\EFI\grub\grubx64.efi"
     ```
     Replace `/dev/sdX` with your disk and `-p 2` with the new EFI partition number.
   - Verify the boot order:
     ```bash
     sudo efibootmgr
     ```
   - Set the Linux entry as the default if desired:
     ```bash
     sudo efibootmgr -o ZZZZ,YYYY  # ZZZZ is Linux, YYYY is Windows
     ```

5. **Test the Dual Boot**:
   - Reboot and access your UEFI firmware (usually by pressing a key like `F2`, `Del`, or `F12` during boot).
   - Ensure both Windows (on the original EFI partition) and Linux (on the new EFI partition) are listed as boot options.
   - Test booting into both operating systems. GRUB should still detect Windows and allow you to boot into it.

6. **Maintain Separate EFI Partitions**:
   - Windows will continue to use its original EFI partition (e.g., `/dev/sdX1`), and Linux will use the new one (e.g., `/dev/sdX2`).
   - Windows updates should no longer affect the Linux EFI partition, as they are separate.

#### Pros and Cons of Separate EFI Partitions
**Pros**:
- Isolates Linux’s bootloader from Windows updates, reducing the risk of Linux becoming unbootable.
- Cleaner separation of boot configurations.

**Cons**:
- More complex setup and maintenance.
- Some UEFI firmware may not handle multiple EFI partitions well, requiring manual boot entry management.
- Requires additional disk space for the second EFI partition.

#### Recommendations
- **Preferred Approach**: Start with **Option 1 (Shared EFI Partition)** and use the mitigation steps (e.g., reinstalling GRUB, setting boot order, disabling Fast Startup). This is simpler and works for most setups.
- **When to Use Separate EFI Partitions**: If Windows updates frequently break your Linux boot and you’re comfortable with advanced partition management, go for **Option 2**. This is especially useful for advanced users who want complete isolation.
- **Regular Backups**: Regardless of the approach, always back up your EFI partition and GRUB configuration before major Windows updates.
- **Use a Boot Repair Tool**: If GRUB breaks, tools like Boot-Repair (available on Ubuntu live USBs) can simplify restoring the Linux bootloader:
  ```bash
  sudo add-apt-repository ppa:yannubuntu/boot-repair
  sudo apt update
  sudo apt install -y boot-repair
  boot-repair
  ```

#### Additional Notes
- If your UEFI firmware doesn’t support multiple EFI partitions, you may need to stick with a shared EFI partition and focus on mitigation steps.
- Some Linux distributions (e.g., Ubuntu, Fedora) handle EFI better than others. Ensure your distribution is up to date.
- If you’re unsure about your disk layout, check it with:
  ```bash
  sudo fdisk -l
  ```
  Look for partitions labeled as “EFI System.”
作者: finfin    時間: 2025-6-8 15:07

Yes, Windows and Linux can share the same EFI System Partition (ESP) for dual booting, but as you’v ...
javacomhk 發表於 2025-6-1 01:41


well and detail! much thanks.
作者: finfin    時間: 2025-6-8 15:08

啱架喇
Okt04175 發表於 2025-5-31 14:07



   





歡迎光臨 電腦領域 HKEPC Hardware (https://h2.hkepc.com/forum/) Powered by Discuz! 7.2