Quadruple system Windows 7, OSX Snow Leopard, Ubuntu Lucid and FreeBSD 8 on GPT with BURG (supports UEFI/Apple EFI/PCBIOS)

ref: http://code.google.com/p/burg/wiki/QuadBoot

 QuadBoot  
Quadruple system Windows 7, OSX Snow Leopard, Ubuntu Lucid and FreeBSD 8 on GPT with BURG (supports UEFI/Apple EFI/PCBIOS)
Updated Mar 22, 2010 by bean12...@gmail.com

Introduction

This guide shows how to install the four OS on GPT and boots with BURG. In preparation, you needs to have:
  • GParted Live CD
  • Windows 7 64-bit Installation DVD
  • Snow Leopard Retail DVD
  • iDeneb or other OSX86 Installation DVD
  • Ubuntu Lucid beta 64-bit DVD or netboot CD
  • FreeBSD 8 amd64 Installation DVD or USB memstick
The following installation process requires to remove all partitions and create new disk layout, make sure to backup important data first !

UEFI

My test environment: HP ProBook 4510s
  • Enter BIOS and turn on UEFI boot mode.
  • Insert Windows 7 64-bit Install DVD. To ensure booting in UEFI mode, press F9 to open boot device selection page, choose "Boot From UEFI File", then browse to \EFI\BOOT\BOOTX64.EFI on DVD.
  • In the disk partition dialog, remove all partitions, then create a new partition using all available space. It should create two extra partition, EFI system partition and Microsoft reserved partition. If you don't see EFI system partition, then it's not using GPT. If this happens, you can try removing all partition, reboot using UEFI mode and try again.
  • Remove that one large partition, and create small partitions for each OS, I use the following partition layout:
    1. EFI system partition (created previously)
    2. Microsoft reserved (created previously)
    3. Windows 7 (at least 20G)
    4. OSX Snow Leopard (at least 10G)
    5. Linux swap
    6. Linux ext4
    7. FreeBSD swap
    8. FreeBSD ufs
    9. Extra OSX partition for leopard
    10. Other data partitions ...
  • After creating partition layout, you can reboot, no need to install windows right now (more on this later).
  • Enter BIOS and turn off UEFI boot mode.
  • Insert GParted Live CD, format the linux ext4 and swap partition. In theory this step could be done by ubuntu installer, but I have encountered some issue and it even mess up the MBR.
  • Reboot and insert the ubuntu lucid install disc. In partition page, don't change partition layout and use the ext4 formatted previously as root device.
  • GRUB2 fails to install properly, but it's still a good idea to choose the install GRUB step as it would download the package automatically.
  • Reboot ubuntu disc into rescue mode, open a shell on linux partition /dev/sda6, and use these commands to install grub2:
  • grub-install --force /dev/sda
    update-grub
  • Reboot and you should be able to enter ubuntu properly. Install burg according to this page InstallUbuntu, then use dd to backup mbr to an usb flash drive.
  • Insert iDeneb DVD, install leopard to the extra OSX partition.
  • Insert ubuntu disc and enter rescue mode, use dd to restore the mbr you have previously saved.
  • After reboot, you enter burg rescue shell, why ? It appears that OSX installer has removed EFI system partition, format microsoft reserved partition as EFI system partition, and create a /EFI/Apple directory in it, what a mess ! (If you install windows previously, it'd be screwed up by this and not repairable, therefore you have to install again.) You can enter this in rescue shell:
  • set prefix=(hd0,5)/boot/burg
    insmod normal
    normal
This would bring you to the normal burg menu, press 'c' to enter a console windows, and enter these commands:
gptsync hd0
reboot
  • Enter BIOS and turn on UEFI boot mode.
  • Insert Windows 7 64-bit Install DVD and boot with UEFI mode. In the partition editor, remove EFI system partition and windows 7 partition, create a new partition in the empty space and the EFI+MS reserved combo reappears. Continue with the installation.
  • After windows is done, boot GParted Live CD, use dd to restore mbr saved previously.
  • Reboot and you should see burg menu, enter ubuntu.
  • It's recommended remove /etc/burg.d/30_os-prober as the boot item generated by os-prober is not much useful, we need to construct menu items manually by create a new script /etc/burg.d/40_custom:
  • #!/bin/sh
    exec tail -n +3 $0# This file provides an easy way to add custom menu entries.  Simply type the
    # menu entries you want to add after this comment.  Be careful not to change
    # the 'exec tail' line above.
    menuentry "Boot Snow Leopard" --class macosx {
      set root=(hd0,4)
      multiboot /boot}
    menuentry "Boot Leopard" --class macosx {
      set root=(hd0,9)
      multiboot /boot}
    menuentry "Boot FreeBSD" --class freebsd {
      set root=(hd0,8)
      kfreebsd /boot/loader}
    menuentry "Reboot to EFI mode" {
      gptsync hd0
      reboot}
then use update-burg to update the configuration file. Mount the EFI partition and create burg directory:
sudo mount /dev/sda1 /mnt
sudo mkdir /mnt/EFI/burg
Download the latest burg-efi64 and burg-themes package from: http://code.google.com/p/burg/downloads/list, extract to /mnt/EFI/burg directory, and rename /mnt/EFI/burg/burg_uefi.cfg as /mnt/EFI/burg/burg.cfg.
  • Reboot, and you should see a new menu "Reboot to EFI mode", use this and it should reboot into EFI mode, which means start windows.
  • If windows doesn't boot properly, use install disk to repair it.
  • Reboot and enter F9 to open boot device selection page, choose "Boot From UEFI File", then browse to \EFI\burg\burg64.efi.
  • Now the EFI version of BURG should start, it would have three menu: "Boot Windows 7", "Boot Ubuntu" and "Reboot to PC mode". Use "Boot Ubuntu" to boot ubuntu in EFI mode.
  • In ubuntu, install efibootmgr:
  • sudo apt-get install efibootmgr
Then use this to add a new EFI boot item for burg:
sudo efibootmgr -v -c -L "BURG" -l "\\EFI\\burg\\burg64.efi"
burg would be the default boot loader for EFI now, you don't need to use "Boot From UEFI File" to choose it.
  • You can use "Reboot to PC mode" and "Reboot to EFI mode" to switch between EFI and PC version of BURG. This feature is implemented using a trick I found out about UEFI firmware. It's very strict with regarding to GPT structure. I set some incompatible field in MBR so that it would be treated as invalid GPT and boot into PC mode. After reconstruct a valid GPT, it would boot into UEFI mode again. This allows you to switch modes without entering BIOS. However, this behavior may not apply to other UEFI implementation. If it doesn't work for you, you have to use BIOS to switch mode.
  • Insert FreeBSD 8 Install DVD or USB memstick, first open a fixit shell, format and mount ufs partition:
  • newfs -O2 -U /dev/da4p8
    mount /dev/sda8 /mnt
Exit fixit shell. In Options, change install root from / to /mnt. Choose "Configure" and "Distribution" to install. Make sure you don't touch the "Fdisk" and "Disklabel" as they'd mess up the MBR. After it, reopen a fixit shell, cd to /mnt/boot, and rename GENERIC directory to kernel. You also need to create /mnt/etc/fstab as follows:
/dev/ad4p7  none  swap  ew  0  0
/dev/ad4p8  /     ufs   rw  1  1
  • Reboot into PC mode, and you should be able to use the "Boot FreeBSD" menu to enter FreeBSD.
  • Use "Boot Leopard" to enter OSX Leopard, insert the snow leopard retail disc and use OSInstall.mpkg to install snow leopard, add kext and related fixes to make it bootable. Finally, copy Chameleon loader boot to the root directory and it can be chainloaded by BURG.

Apple EFI

My test environment: Mac Mini 3.1 (early 2009 version)
  • Install OSX install disc and create the partition layout. OSX is very picky for GPT structure and refuses to install to GPT created by GParted. Please note that the EFI system partition is hidden from the disk utility, so you starts with microsoft reserved partition. After partition, install OSX normally.
  • After OSX boots, use dd to backup mbr. Then install rEFIt loader.
  • Create /EFI/burg directory in OSX. Download the latest burg-efi64 and burg-themes package fromhttp://code.google.com/p/burg/downloads/list, extract to /EFI/burg directory, and rename /mnt/EFI/burg/burg_apple.cfg as /mnt/EFI/burg/burg.cfg. Now you can start the EFI version of BURG in rEFIt menu.
  • Insert GParted Live CD, format ms reserved and windows 7 partition as ntfs, and format the linux partition as ext4.
  • Insert Ubuntu disc and install. As previously, GRUB2 fails to install, and this time it even mess up MBR. Restore the backup mbr, then reboot ubuntu disc and enter rescue mode, use the following commands to install grub2 manually:
  • grub-install --force /dev/sda
    update-grub
  • Reboot and use rEFIt to enter PC mode, you should be able to boot into ubuntu. Install burg according to this page InstallUbuntu.
  • As before, remove /etc/burg.d/30_os-prober and create our own script /etc/burg.d/40_custom:
  • #!/bin/sh
    exec tail -n +3 $0# This file provides an easy way to add custom menu entries.  Simply type the
    # menu entries you want to add after this comment.  Be careful not to change
    # the 'exec tail' line above.
    menuentry "Boot Windows" --class windows {
      set root=(hd0,2)
      chainloader +1
    }
    menuentry "Boot FreeBSD" --class freebsd {
      set root=(hd0,8)
      kfreebsd /boot/loader}
then use update-burg to update the configuration file.
  • Reboot into BURG (PC or EFI), use gptsync to create hybrid MBR:
  • gptsync hd0 2+ 3 4
    reboot
The advantage of BURG's gptsync is that you can choose which partition to mapped into MBR slots. For example, if you have a data partition at (hd0,10), you can use this to make it visible to Windows:
gptsync hd0 2+ 3 10
  • Insert Windows install disc and install. Windows 7 EFI don't support apple's implementation, you can only install using PC mode. Don't change any partition structure, just install to the partition allocated to it.
  • Windows would overwrite MBR, use rescue mode from ubuntu disc to reinstall burg:
  • burg-install --force /dev/sda
    update-burg
  • Now it's time to install FreeBSD, although it's a little tricky as the generic kernel hangs on apple hardware. You need to follow instruction here http://wiki.freebsd.org/AppleMacbook , revert r189055 and rebuild a new kernel from another FreeBSD machine. After that, copy new kernel, mfsroot.gz and devices.hints from boot directory of FreeBSD 8 install disc to /fbsd_install/ directory in ubuntu partition.
  • Reboot into PC version of BURG, enter the following commands from console to launch the FreeBSD installer:
  • set root=(hd0,6)
    kfreebsd /fbsd_install/kernel
    kfreebsd_module /fbsd_install/mfsroot.gz type=mfs_root
    kfreebsd_loadenv /fbsd_install/devices.hintset FreeBSD.vfs.root.mountfrom=ufs:/dev/md0
    boot
After that, install FreeBSD using similar method described in UEFI section.

PCBIOS

Install in PCBIOS machine is a combination of the above methods, here are highlights:
  • Install iDeneb OSX first, use it to create the partition layout.
  • Install Ubuntu next, install burg
  • Use gptsync to create hybrid MBR, then install Windows 7.
  • Fix burg boot loader.
  • Install FreeBSD.

how to /boot being a symlink to /efi/boot and ZFS

UEFI Firmware

ref: http://www.thinkwiki.org/wiki/UEFI_Firmware



Contents

[hide]

UEFI Firmware

UEFI (Unified Extensible Firmware Interface) is a modernized replacement to BIOS (Basic Input/Output System). The specification is maintained by the collaborative non-profit UEFI Forum. UEFI is supported by both recent versions of both Linux and Windows. UEFI firmware with legacy BIOS support has started appearing on Sandybrige (220,420,520,etc.) Thinkpads. On supported machines, the firmware configuration utility (Thinkvantage->F1 on machine startup) has the option of enabling one or both UEFI/BIOS as well as providing the option to specify the order with which the machine tries to boot.

Current Status

Though the specification has been around since the late '90s, UEFI only recently started appearing on commodity hardware. Macs are a slight exception, though they do not strictly adhere to the UEFI standard. Linux can boot as usual in BIOS mode, however the ELILO boot loader or recent versions of Grub 2 are necessary to boot in UEFI mode. Linux 3.0-rc1 is reported to successfully boot in UEFI mode (details below), but older versions hang after the kernel gets loaded by grub.

Enabling UEFI boot in Debian

The following are steps to successfully boot in pure UEFI mode ("UEFI only" startup config menu). There are likely some that are redundant or unnecessary.
  1. Install 64-bit Debian in BIOS mode to an MBR partitioned disk.
  2. Install Kernel 3.0-rc1 or later. Enable CONFIG_EFI,CONFIG_FB_EFI,CONFIG_EFI_VARS,CONFIG_EFI_PARTITION.
  3. Create a small ~ 200MB Partition formatted to fat32 and enable the "boot" flag. The first partition is a good choice, but is not strictly required. The "boot" flag is also likely superstitious.
  4. Burn some form of live cd that allows you access your Debian install in case something goes wrong and you are unable to boot.
  5. Mount the fat32 partition at /boot/efi
    sudo mkdir /boot/efi
    sudo mount /dev/sda1 /boot/efi
  6. Install the efi version of grub
    aptitude install grub-efi-amd64
  7. Now run grub-install (ignore warnings about efivars)
    sudo grub-install /dev/sda
    sudo update-grub
  8. This should have created /boot/efi/efi/debian/grubx64.efi. In order to make this actually work without running efibootmgr (which is not possible in bios mode), just copy it to /boot/efi/efi/boot/bootx64.efi
    sudo mkdir /boot/efi/efi/boot/
    sudo cp /boot/efi/efi/debian/grubx64.efi /boot/efi/efi/boot/bootx64.efi
  9. Reboot, enter the Thinkvantage menu and set "UEFI only" or "UEFI First". Hopefully you still get a grub menu and it will actually boot the 3.0 kernel. Older kernels appear to freeze with a blank screen as soon as grub loads them.

Links

版本說明

ref:http://registerboy.pixnet.net/blog/post/19136842-trial-,-alpha-,-rc-,-beta-%E7%89%88%E6%9C%AC%E8%A7%A3%E9%87%8B


版本号:
V(Version):即版本,通常用数字表示版本号。
Build:用数字或日期标示版本号的一种方式。
SP:Service Pack,升级包。

授权和功能划分:
Trial:试用版,通常都有时间限制,有些试用版软件还在功能上做了一定的限制。可注册或购买成为正式版。
Unregistered:未注册版,通常没有时间限制,在功能上相对于正式版做了一定的限制。可注册或购买成为正式版。
Demo:演示版,仅仅集成了正式版中的几个功能,不能升级成正式版。
Lite:精简版。
Full:完整版。

开发阶段划分:
α(Alpha)版:内测版,内部交流或者专业测试人员测试用。Bug较多,普通用户最好不要安装。
β(Beta)版:公测版,专业爱好者大规模测试用,存在一些缺陷,该版本也不适合一般用户安装。 
γ(Gamma)版 :相当成熟的测试版,与即将发行的正式版相差无几。
RC版:Release Candidate候选版本,处于Gamma阶段。从Alpha到Beta再到Gamma是改进的先后关系,但RC1、RC2往往是取舍关系。
Final:正式版。

语言划分:
SC:Simplified Chinese简体中文版。
GBK:简体中文汉字内码扩展规范版。
TC:Traditional Chinese繁体中文版。
BIG5:繁体中文大五码版。
UTF8:Unicode Transformation Format 8 bit,对现有的中文系统不是好的解决方案。

Alpha:
是内部测试版,一般不向外部发布,会有很多Bug.一般只有测试人员使用。

Beta:
也是测试版,这个阶段的版本会一直加入新的功能。在Alpha版之后推出。

RC:(Release Candidate)
顾名思义么 ! 用在软件上就是候选版本。系统平台上就是发行候选版本。RC版不会再加入新的功能了,主要着重于除错。

RTM:(Release to Manufacture)
是给工厂大量压片的版本,内容跟正式版是一样的,不过RTM版也有出限制、评估版的。但是和正式版本的主要程序代码都是一样的。

OEM:
是给计算机厂商随着计算机贩卖的,也就是随机版。只能随机器出货,不能零售。只能全新安装,不能从旧有操作系统升级。包装不像零售版精美,通常只有一面CD和说明书(授权书)。

RVL:
号称是正式版,其实RVL根本不是版本的名称。它是中文版/英文版文档破解出来的。

EVAL:
而流通在网络上的EVAL版,与“评估版”类似,功能上和零售版没有区别。

RTL:Retail(零售版)
是真正的正式版,正式上架零售版。在安装盘的i386文件夹里有一个eula.txt,最后有一行EULAID,就是你的版本。比如简体中文正式版是EULAID:WX.4_PRO_RTL_CN,繁体中文正式版是WX.4_PRO_RTL_TW。其中:如果是WX.开头是正式版,WB.开头是测试版。_PRE,代表家庭版;_PRO,代表专业版。

Installing FreeBSD on a GPT disk


Synopsis:

These notes describe the general process for manually installing FreeBSD onto a GPT-partitioned hard disk.

Prerequisites:

Process:

  1. Boot from the FreeBSD install DVD or USB stick and run the Fixit environment.
  2. Create new partition table on ad0 using GPT scheme:
  3. # gpart create -s GPT ad0
  4. Add 'freebsd-boot' partition to contain boot code ('-s' argument specifies partition size in 512 byte blocks):
  5. # gpart add -t freebsd-boot -s 128 ad0
  6. Write Protective MBR to sector 0 of disk and gptboot code into freebsd-boot partition
  7. # gpart bootcode -b /dist/boot/pmbr -p /dist/boot/gptboot -i 1 ad0
  8. Add 'freebsd-swap' partition:
  9. # gpart add -t freebsd-swap -s 8388608 ad0
  10. Add appropriately sized 'freebsd-ufs' partitions for /, /var, /usr and /home filesystems (I use swap-based tmpfs for /tmp)
  11. # gpart add -t freebsd-ufs -s 2097152 ad0
    # gpart add -t freebsd-ufs -s 2097152 ad0
    # gpart add -t freebsd-ufs -s 41942040 ad0
    # gpart add -t freebsd-ufs ad0
    
  12. List our partition table so far
  13. # gpart show ad0
    =>       34  312581741  ad0  GPT  (149G)
             34        128    1  freebsd-boot  (64K)
            162    8388608    2  freebsd-swap  (4.0G)
        8388770    2097152    3  freebsd-ufs  (1.0G)
       10485922    2097152    4  freebsd-ufs  (1.0G)
       12583074   41942040    5  freebsd-ufs  (20G)
       54525114  258056661    6  freebsd-ufs  (123G)
    
  14. Format freebsd-ufs partitions (p3 will be the root partition so softupdates are not enabled with '-U')
  15. # newfs ad0p3
    # newfs -U ad0p4
    # newfs -U ad0p5
    # newfs -U ad0p6
    
  16. Mount partitions under /mnt:
  17. # mount /dev/ad0p3 /mnt
    # cd /mnt
    # mkdir var usr home
    # mount /dev/ad0p4 /mnt/var
    # mount /dev/ad0p5 /mnt/usr
    # mount /dev/ad0p6 /mnt/home
    
  18. Install FreeBSD distribution to mounted filesystems:
  19. # export DESTDIR=/mnt
    # cd /dist/8.1-RELEASE
    # for dir in base catpages dict doc info lib32 manpages; do (cd $dir; ./install.sh); done
    # cd kernels
    # ./install.sh GENERIC
    # cd src
    # ./install.sh all
    
  20. Copy GENERIC kernel to expected location:
  21. # cd /mnt/boot
    # rmdir kernel
    # cp -Rp GENERIC kernel
    
  22. Create a new fstab
  23. # cd /mnt/etc
    # vi fstab
    
    /dev/ad0p3      /       ufs     rw      1       1
    /dev/ad0p4      /var    ufs     rw      2       2
    /dev/ad0p5      /usr    ufs     rw      2       2
    /dev/ad0p6      /home   ufs     rw      2       2
    /dev/ad0p2      none    swap    sw      0       0
    
  24. The hard disk now contains a minimal, unconfigured FreeBSD installation and should be bootable. Exit the Fixit environment, exit Sysinstall and reboot. Remove the CD while the machine resets.
  25. FreeBSD should boot up cleanly. Perform basic configuration steps:
    • Set root's password
    • Create /etc/rc.conf, setting hostname, network interface configuration, sshd_enable, etc
    • Set timezone by copying appropriate timezone file from /usr/share/zoneinfo/*/ to /etc/localtime
    • Create non-root user account

About installing FreeBSD to GPT...


gpart create -s gpt ad2
gpart bootcode -b /boot/pmbr ad2

gpart add -s $(( $(du -sk /boot/gptboot | cut -f 1) * 2 )) -t freebsd-boot ad2
gpart bootcode -p /boot/gptboot -i 1 ad2

gpart add -s 2G -t freebsd-ufs ad2
gpart add -s 4G -t freebsd-swap ad2
gpart add -s 9G -t freebsd-ufs ad2 
gpart add -s 17G -t freebsd-ufs ad2 
gpart add -t freebsd-ufs ad2 

gjournal label /dev/ad2p2
gjournal label /dev/ad2p4
gjournal label /dev/ad2p5
gjournal label /dev/ad2p6

newfs -J /dev/ad2p2.journal
newfs -J /dev/ad2p4.journal
newfs -J /dev/ad2p5.journal
newfs -J /dev/ad2p6.journal

mount /dev/ad2p2.journal /mnt
cd /; pax -p e -r -w -v -X -Y -Z . /mnt
umount /mnt

mount /dev/ad2p4.journal /mnt
cd /tmp; pax -p e -r -w -v -X -Y -Z . /mnt
umount /mnt

mount /dev/ad2p5.journal /mnt
cd /var; pax -p e -r -w -v -X -Y -Z . /mnt
umount /mnt

mount /dev/ad2p6.journal /mnt
cd /usr; pax -p e -r -w -v -X -Y -Z . /mnt
umount /mnt

GPT


PRÉPARATION DU DISQUE AD2

Pour le fun je me suis dis que j'allais partitionner mon disque au format GPT, puisque c'est à la mode (ça sert à rien dans mon cas, mais je voulais jouer avec)
j'ai donc détruit le partionnement existant :
$ gpart destroy ad2
Puis recréer en précisant le système de partitionnement GPT
$ gpart create -s GPT ad2
Une vérification que tout c'est bien passé :
$ gpart show
=>       34  156301421  ad2  GPT  (75G)
      34  156301421        - free -  (75G)
Les BIOS classiques ne sont pas capable de booter sur du GPT, mais sous FreeBSD il y a une astuce qui marche impeccable
$ gpart add -b 34 -s 16 -t freebsd-boot ad2
$ gpart bootcode -b /boot/pmbr ad2
$ cp /boot/gptboot /tmp
$ dd if=/dev/zero bs=641 count=1 >> /tmp/gptboot
$ dd if=/tmp/gptboot of=/dev/ad2p1 bs=512
ainsi le système est bootable;
j'ai plus qu'à recréer mes partitions
$ gpart add -b 50 -s 20971520 -t freebsd-ufs ad2
$ gpart add -b 20971570 -s 4194304 -t freebsd-swap ad2
$ gpart add -b 25165874 -s 131135581 -t freebssd-ufs ad2
Vérification :
$ gpart show
=>       34  156301421  ad2  GPT  (75G)
  34         16    1  freebsd-boot  (8.0K)
  50   20971520    2  freebsd-ufs  (10G)
   20971570    4194304    3  freebsd-swap  (2.0G)
   25165874  131135581    4  freebsd-ufs  (63G)
maintenant j'active le gjournal pour les partitions ufs
$ gjournal label /dev/ad2p2
$ gjournal label /dev/ad2p4
On format le tout (pour rappel sous freebsd pas besoin de formatter les partitions swap
$ newfs -J -L root /dev/ad2p2.journal
$ newfs -J -L home /dev/ad2p4.journal
Le -L signifie que l'on écrit un label ainsi les partitions sont facilement montable grâce à GLABEL qui les représente sous la forme : /dev/ufs/LABEL

MIGRATION DES DONNÉES

maintenant il s'agit de migrer le contenu des partitions / et /home sur les nouvelles le tout à chaud :
$ mkdir /newroot
$ mount -o async /dev/ufs/root /newroot
$ cd /newroot
$ dump -0uanL -f - / | restore -rf -
$ mkdir /home2
$ mount -o async /dev/ufs/home /home2
$ cd /home2
$ dump -0uanL -f - /home | restore -rf -
il faut pour finir modifier la fstab du nouveau root pour rajouter :
  • /dev/ufs/root comme partition / (et rajouter l'option async)
  • /dev/ufs/home comme partition /home (et mettre l'option async)
  • /dev/ad2p3 comme swap
Le fichier /etc/fstab obtenu est donc :
# Device  Mountpoint FStype Options  Dump Pass#
/dev/ad2p3  none  swap sw  0 0
/dev/ufs/root  /  ufs rw,async 1 1
/dev/ufs/bapt  /home ufs rw,async 1 1
Il ne reste plus qu'à rebooter dessus.

FREEBSD 使用gpart建立超過2tb的分割區


ref:http://hd-inky.blogspot.com/2010/07/freebsd-gpart2tb.html


FREEBSD 使用gpart建立超過2tb的分割區

gpart 是 GEOM framework 裡的 tool,


透過它可以支援 multiple partitioning schemes,
在 FreeBSD 7 開始比較建議使用 gpart 而不是 gpt。


gpart跟gpt的指令參數不太一樣 不能直接套用
# gpart create -s GPT da2
# gaprt show

=> 6 1953124597 da2 GPT (7.3T)
6 1953124597 - free - (7.3T)

# gpart add -b 6 -s 1953124597 -t freebsd-ufs da2
da2p1 added

-b -s -t 這三個參數必填
-b是start , -s 是size -t是fs_type



# gpart show
=> 6 1953124597 da2 GPT (7.3T)
6 1953124597 1 freebsd-ufs (7.3T)

# newfs -O2 -b 65536 -f 8192 -U /dev/da2p1

# mount /dev/da2p1 /raid1

#df -h

Filesystem Size Used Avail Capacity Mounted on
/dev/da0s1a 62G 3.7G 54G 6% /

devfs 1.0K 1.0K 0B 100% /dev
/dev/da2p1 7.2T 16K 6.6T 0% /raid1

Install FreeBSD with GPT partitions ...

ref: http://www.freebsdonline.com/content/view/732/531/

For now sysinstall does not support GPT partition. So everything must be installed manualy but it is easy. This quick tutorial show you stept by step installation using GPT partitions. Why GPT? Better support for bigger drives (>2TB) and up to 128 partitions instead of 4.

Step 1. Partitioning the drive
----------------------------------
We boot from FreeBSD 8.2 USB image and then we go to Fixit menu and then from there we mount USB Live image, that has all necessary tools to install FreeBSD.

First we will initialize the drive to support GPT partitions:

  gpart create -s GPT ad0

Then we will proceed creating partitions. We will create partitions for boot, root, tmp, var, usr.

  gpart add -s 128 -t freebsd-boot -l boot ad0                       # for boot     (1)
  gpart add -s 5G -t freebsd-ufs -l root ad0                          # for / (root)  (2)
  gpart add -s 4G -t freebsd-ufs -l tmp ad0                          # for tmp       (3)
  gpart add -s 4G -t freebsd-swap -l swap ad0                       # for swap     (4)
  gpart add -s 10G -t freebsd-ufs -l var ad0                        # for var        (5)
  gpart add -s 200G -t freebsd-ufs -l usr ad0                      # for usr and home  (6)

To see partitions you've just created use:

  gpart show ad0

To see partition with labels use:

  gpart show -l ad0

To delete a partiton use:

  gpart delete -i3 ad0              # where 3 is third partiton.

If you want to remove GPT table from drive ad0 run (in case you want start partitioning process again):

  gpart destroy ad0


Now we will place the MBR code in our freebsd-boot partition:

  gpart bootcode -b /mnt2/boot/pmbr -p /mnt2/boot/gptboot -i 1 ad0

We need now to newfs (format) our newly created partitions:

  newfs -U /dev/ad0p2
  newfs -U /dev/ad0p3
  newfs -U /dev/ad0p5
  newfs -U /dev/ad0p6

We will mount now all partitions to install FreeBSD on them:

  mount /dev/ad0p2 /mnt
  mkdir /mnt/boot /mnt/tmp /mnt/var /mnt/usr
  mount /dev/ad0p3 /mnt/tmp
  mount /dev/ad0p5 /mnt/var  mount /dev/ad0p6 /mnt/usr


Step 2. Installing FreeBSD
-------------------------------
We will now use the install.sh script from our FreeBSD USB Image:

  export DESTDIR=/mnt
  cd /dist/8.2-RELEASE
  for dir in base catpages dict doc info lib32 manpages; do (cd $dir; ./install.sh); done

If you install FreeBSD i386 you will not need lib32 in the for loop.
Now we install the kernel:

  cd kernels
  ./install.sh GENERIC

We install the sources:

  cd ..
  cd src
  ./install.sh all

We copy the kernel in /mnt/boot/kernel directory:

  cd /mnt/boot
  rmdir kernel
  cp -Rp GENERIC kernel


Step 3. Configuring FreeBSD
-----------------------------------

Last step is to configure FreeBSD by creating /etc/fstab, /etc/resolv.conf and /etc/rc.conf files.

We edit /mnt/etc/resolv.conf file and add our dns there:

  nameserver 208.67.220.220           # that is your ISP's DNS


We create /etc/rc.conf with the following content (asuming em0 is our network card):


/etc/rc.conf
defaultrouter="10.0.0.1"
hostname="server"
ifconfig_em0="inet 10.0.0.2  netmask 255.255.255.0"
sshd_enable="YES"
We must create an /etc/fstab file with the following content:
/etc/fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad0p4             none            swap    sw              0       0
/dev/ad0p2             /               ufs     rw              1       1
/dev/ad0p3             /tmp            ufs     rw              2       2
/dev/ad0p6             /usr            ufs     rw              2       2
/dev/ad0p5             /var            ufs     rw              2       2
/dev/cd0               /cdrom          cd9660  ro,noauto       0       0

GPT Partitioning Tips
----------------------
- If you get the error "Device Busy" when you try to delete GPT from drive with gpart delete ad0 , you can succesfully delete GPT if you turn of the safety with sysctl variable:

  sysctl kern.geom.debugflags=16


- If you want to destroy GPT table from the drive with gpart delete ad0 command you must first delete all partitions (Otherwise you might get "Device Busy" error.

虹光大成就-密教灌頂(一)