about 7 years ago
# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

首先先切2M給GRUB,注意type為EF02 (BIOS boot partition)
這裡把編號設為128,維持/boot還是/dev/sd[ab]1

Command (? for help): n
Partition number (1-128, default 1): 128
First sector (34-20971486, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-20971486, default = 20971486) or {+-}size{KMGTP}: +2M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): EF02
Changed type of partition to 'BIOS boot partition'

/boot
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-20971486, default = 6144) or {+-}size{KMGTP}:
Last sector (6144-20971486, default = 20971486) or {+-}size{KMGTP}: +100M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): FD00
Changed type of partition to 'Linux filesystem'

swap,注意type為8200 (Linux swap)
Command (? for help): n
Partition number (2-128, default 2):
First sector (34-20971486, default = 210944) or {+-}size{KMGTP}:
Last sector (210944-20971486, default = 20971486) or {+-}size{KMGTP}: +1G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8200
Changed type of partition to 'Linux swap'

/ (root)
Command (? for help): n
Partition number (3-128, default 3):
First sector (34-20971486, default = 2308096) or {+-}size{KMGTP}:
Last sector (2308096-20971486, default = 20971486) or {+-}size{KMGTP}: +20G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8300
Changed type of partition to 'Linux filesystem'

Command (? for help): p
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            6144          210943   100.0 MiB   FD00  Linux RAID
   2          210944         2308095   1024.0 MiB  8200  Linux swap
   3         2308096        62914526   28.9 GiB    8300  Linux filesystem
 128            2048            6143   2.0 MiB     EF02  BIOS boot partition


Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.

# sgdisk /dev/sda  -R=/dev/sdb

# sgdisk -G /dev/sdb

# mkfs.btrfs -d raid1 /dev/sda3 /dev/sdb3
# btrfs filesystem show /dev/sda3
# mount -o defaults,noatime,noacl,compress=lzo,inode_cache,space_cache,autodefrag /dev/sda3 /mnt/btrfs-root
# cd /mnt/btrfs-root
# btrfs subvolume create root_subvolume
# cd root_subvolume
# btrfs subvolume create home
# btrfs subvolume create var
# btrfs subvolume create usr
# btrfs subvolume create tmp
# btrfs subvolume list -p .
ID 258 gen 12 parent 5 top level 5 path root_subvolume
ID 259 gen 7 parent 258 top level 258 path home
ID 261 gen 9 parent 258 top level 258 path var
ID 262 gen 10 parent 258 top level 258 path usr
ID 263 gen 12 parent 258 top level 258 path tmp
# cd ../
# chmod -R 0755 root_subvolume //看起來沒用
# mkdir /mnt/btrfs-system
# mount -o subvol=root_subvolume,defaults,noatime,noacl,compress=lzo,inode_cache,space_cache,autodefrag /dev/sda3 /mnt/btrfs-system
//swap boot 按原本的 並mount到正確位置上 
# cd /mnt/btrfs-system
# mdadm --create --verbose /dev/md1 --level=mirror --raid-devices=2 /dev/sd{a,b}1
# mdadm --detail --scan | tee -a /etc/mdadm.conf
# mkswap /dev/sda2
# mkswap /dev/sdb2
# swapon /dev/sd{a,b}2
# mkfs.ext2 /dev/md1
# mkdir /mnt/boot && mount /dev/md1 /mnt/boot
//安裝系統
# cd /
# pacstrap /mnt/btrfs-system base base-devel
# genfstab -U -p /mnt/btrfs-system | tee /mnt/btrfs-system/etc/fstab
# vi /mnt/btrfs-system/etc/fstab
# cp /etc/mdadm.conf /mnt/btrfs-system/etc/
\# /dev/sda3
UUID=5e36cd15-3f29-4b57-a99d-0d3230c1e483       /               btrfs           rw,noatime,compress=lzo,noacl,space_cache,autodefrag,inode_cache,subvol=root_subvolume  0 0
\# /dev/md1
UUID=21f392d6-fc78-44f5-9c05-b555a3dbbffb       /boot           ext2            rw,relatime     0 2
\# /dev/sda2
UUID=bd4c005a-e81c-46d4-9c46-f1e35f9e9b6c       none            swap            defaults        0 0
\# /dev/sdb2
UUID=1fa9b186-a957-4e14-a260-ae3eee5da8f2       none            swap            defaults,pri=-2 0 0
//chroot  安裝btrfs-progs
# arch-chroot /mnt/btrfs-system
# pacman -S btrfs-progs
# hostnamectl set-hostname linuxn.cs.nctu.edu.tw
# echo "KEYMAP=us" > /etc/vconsole.conf
# ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime
# hwclock --systohc --utc --adjfile /etc/adjtime
# vi /etc/locale.gen
en_US.UTF-8 UTF-8
en_US ISO-8859-1
zh_CN.UTF-8 UTF-8
zh_CN GB2312
zh_TW.UTF-8 UTF-8
zh_TW BIG5
# locale-gen
# echo "LANG=en_US.UTF-8" > /etc/locale.conf
# pacman -S openssh
# systemctl enable sshd.service
# vi /etc/mkinitcpio.conf
HOOKS="base udev autodetect modconf block filesystems keyboard mdadm_udev btrfs"
# mkinitcpio -p linux
# pacman -S grub
# grub-install --target=i386-pc --recheck /dev/sda
# grub-install --target=i386-pc --recheck /dev/sdb
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
vi /etc/default/grub 
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset"
# grub-mkconfig -o /boot/grub/grub.cfg
# passwd
# exit
# reboot

20141111...
未完
← Ubuntu Server 12.04 lts change language(locale) floodlight-plus+mininet+wireshark openflow 1.3 ubuntu 14.04lts →