wiki:jazz/13-11-23

2013-11-23

4TB 硬碟開機

  • <狀況> 使用 preseed 安裝 Ubuntu 12.04.3 到一 4TB 硬碟,分割區自動切割為 /dev/sda1 (未格式化) , /dev/sda2 (EXT4), /dev/sda3 (SWAP)
    • 掛載 /dev/sda2 確實有 Ubuntu 12.04.3 安裝後的檔案,但無法開機。
  • <實驗> 產生一個 4TB 的虛擬硬碟給 VirtualBox 用。
    • 首先,VirtualBox 支援的虛擬磁碟上限是 2TB。
    • 所以只好透過 qemu-img 來產生 4TB 的虛擬硬碟。
      ~$ sudo apt-get install qemu-utils
      ~$ qemu-img create -f vmdk Ubuntu_4TB.vmdk 4T
      
    • 其次,將 VirtualBox 的 EFI BIOS 支援啟動。
    • 第三,VirtualBox 會抱怨 Host OS 本機並沒有那麼大的硬碟,必須忽略警告。
    • No image "VirtualBox_Warning_4TB.png" attached to jazz/13-11-23
    • 分別使用 BigTop 自動安裝光碟 0.7.0 版 與 ubuntu-12.04.3-desktop-i386.iso , ubuntu-13.04-server-amd64.iso 的圖形/文字介面安裝,均會出現以下畫面:
  • <懷疑> 找了些資料,首先,因為硬碟總容量太大(超過 2.2TB),磁碟分割必須改用 GPT。這一點 Ubuntu 12.04.3 確實已經改用 GPT 了。(11.10 以後版本支援 UEFI;12.10 或 12.04.2 以後版本,已支援 UEFI SecureBoot。) - 參考資料
    Use a supported version of Ubuntu. Support for UEFI appeared in 11.10, but has become more reliable in next versions. 
    Support for UEFI SecureBoot appeared in 12.10 and 12.04.2. 
    
    • 驗證是否在 EFI 模式下的方法:
    • 根據Ubuntu 社群 UEFI 維基文件,如果在 EFI 模式下,開機畫面會是
    • 若不是在 EFI 模式下,開機畫面會是
      • http://pix.toile-libre.org/upload/original/1347445119.png
    • 另一種方式是判斷有沒有 /sys/firmware/efi 的系統目錄 - 參考資料
    • 其次,應該就是 grub 如何正確安裝到 GPT 的硬碟上,好讓它可以正常開機。
    • 條件一:Linux Kernel 支援 CONFIG_EFI_PARTITION - 參考來源
      EFI GUID Partition support works on both 32bit and 64bit platforms. You must include GPT support in kernel in order to use GPT. 
      If you don't include GPT support in Linux kernel, after rebooting the server, the file system will no longer be mountable or 
      the GPT table will get corrupted. By default Redhat Enterprise Linux / CentOS comes with GPT kernel support. 
      However, ***if you are using Debian or Ubuntu Linux,*** you need to recompile the kernel. 
      Set CONFIG_EFI_PARTITION to y to compile this feature. 
      
    • 驗證: Ubuntu 12.04.2 採用的 Linux Kernel 已有編入 EFI 支援。
      ~$ lsb_release -a
      No LSB modules are available.
      Distributor ID:	Ubuntu
      Description:	Ubuntu 12.04.2 LTS
      Release:	12.04
      Codename:	precise
      jazz@jazzbook:~$ uname -a
      Linux jazzbook 3.2.0-56-generic-pae #86-Ubuntu SMP Wed Oct 23 17:51:27 UTC 2013 i686 i686 i386 GNU/Linux
      jazz@jazzbook:~$ grep EFI /boot/config-3.2.0-*-pae
      /boot/config-3.2.0-45-generic-pae:CONFIG_EFI=y
      /boot/config-3.2.0-45-generic-pae:CONFIG_FB_EFI=y
      /boot/config-3.2.0-45-generic-pae:CONFIG_EFI_VARS=y
      /boot/config-3.2.0-45-generic-pae:# CONFIG_EFI_VARS_PSTORE is not set
      /boot/config-3.2.0-45-generic-pae:CONFIG_CACHEFILES=m
      /boot/config-3.2.0-45-generic-pae:# CONFIG_CACHEFILES_DEBUG is not set
      /boot/config-3.2.0-45-generic-pae:# CONFIG_CACHEFILES_HISTOGRAM is not set
      /boot/config-3.2.0-45-generic-pae:CONFIG_EFI_PARTITION=y
      /boot/config-3.2.0-56-generic-pae:CONFIG_EFI=y
      /boot/config-3.2.0-56-generic-pae:CONFIG_FB_EFI=y
      /boot/config-3.2.0-56-generic-pae:CONFIG_EFI_VARS=y
      /boot/config-3.2.0-56-generic-pae:# CONFIG_EFI_VARS_PSTORE is not set
      /boot/config-3.2.0-56-generic-pae:CONFIG_CACHEFILES=m
      /boot/config-3.2.0-56-generic-pae:# CONFIG_CACHEFILES_DEBUG is not set
      /boot/config-3.2.0-56-generic-pae:# CONFIG_CACHEFILES_HISTOGRAM is not set
      /boot/config-3.2.0-56-generic-pae:CONFIG_EFI_PARTITION=y
      
    • 條件二:磁區必須是 BIOS Boot Partition 或 EFI System Partition - 參考來源
      Be aware that if you're booting from a GPT disk, you may need to include special partitions -- 
      either a BIOS Boot Partition for BIOS-based computers or an EFI System Partition (ESP) for EFI- or UEFI-based computers. 
      If the disk isn't a boot disk, you don't need these features. 
      
    • 驗證工具:gdisk , sgdisk
      parted isn't the only GPT-capable partitioning tool in Linux. Anything based on libparted (parted, GParted, 
      Palimpsest Disk Utility, or others) will do, as will the GPT fdisk tools (gdisk or sgdisk). The util-linux 
      tools (fdisk, sfdisk, and cfdisk) can't handle GPT. The Ubuntu installer is based on libparted and so is GPT-capable.
      
  • <參考解法>
  • 告訴 GRUB2 該用 GPT - 參考來源
    grub-install --modules=part_gpt /dev/sda
    grub-mkconfig -o /boot/grub/grub.cfg
    
  • 使用 Ubuntu 提供的 Boot-RepairLinuxSecureRemix

Preseed.cfg

  • partman-auto recipe - 參考資料
    And finally, an example of how to set up the efi boot partition needed on
    ia64.
    
    100 100 150 fat16
            $primary{ }
            method{ efi }
            format{ } .
    
    For other examples, see the architecture-specific recipes in partman-auto.
    
Last modified 10 years ago Last modified on Nov 26, 2013, 1:42:08 AM

Attachments (11)

Download all attachments as: .zip