Over 2T Partition

 

 


直接由 BIOS 改成 EFI 會 boot 唔到

 

ESXi 7

 

 


EFI Layout

 

# Centos 6

sda1 200M /boot/efi (vfat) # EFI System Partition
sda2 500M /boot (ext4)
sda3 LVM

 * 如果 Partiton 要 over 2T, 那要用 GPT, 但轉整個系統(包括 /boot)很難, 所以只轉 '/' 用 GPT

 


Chroot "/" to GPT

 

# 系統本身有獨立的 /boot

mount | grep boot

/dev/sda1 on /boot type ext4 (rw)

# Check Partitation Size

# -u     When listing partition tables, give sizes in sectors instead of cylinders.

fdisk -l -u /dev/sda

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      411647      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2          411648     2508799     1048576   82  Linux swap / Solaris
....

411648 * 512byte / 1024 / 1024 = 201m

# Clone "/boot"

blkid /dev/sdc

dd if=/dev/sda of=/dev/sdc bs=1M count=201

fdisk /dev/sdc

fdisk -l -u /dev/sdc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048      411647      204800   83  Linux

# Copy "/"

parted /dev/sdb

(parted) mklabel gpt

(parted) mkpart rootfs ext4 0% 100%

(parted) print

blkid /dev/sdb1

mkfs.ext4 /dev/sdX1

mkdir /mnt/rootfs /mnt/new-rootfs

mount /dev/sdb1 /mnt/new-rootfs

mount /dev/sda3 /mnt/rootfs

echo "vbell off" > ~/.screenrc

rsync -a --exclude="lost+found/" /mnt/rootfs/ /mnt/new-rootfs/

# Modify Setting

blkid /dev/sdc1

/dev/sdc1: UUID="305b00f0-7f55-40eb-a3ef-2332542e7a02" TYPE="ext4"

blkid /dev/sdb1

/dev/sdb1: UUID="df249160-8b81-4a30-baf2-02a21a0c4add" TYPE="ext4"

rm -rf /mnt/new-rootfs/boot

mkdir /mnt/new-rootfs/boot

touch /mnt/new-rootfs/boot/mountpoint

mount /dev/sdc1 /mnt/new-rootfs/boot

chroot /mnt/new-rootfs

vim /etc/fstab

UUID=df249160-8b81-4a30-baf2-02a21a0c4add /                       ext4  noatime 0 0
UUID=305b00f0-7f55-40eb-a3ef-2332542e7a02 /boot                   ext4  defaults 0 0
#UUID=1d5260c6-9e2c-4fad-9827-b8d79c241de3 swap                    swap    defaults        0 0

cat /etc/sysconfig/grub # 在 VM 加 HDD 要跟次要, 否則 sdc(/boot) 做唔到 sda

boot=/dev/sda

/boot/grub/grub.conf

# "/" 的 UUID

kernel /vmlinuz-2.6.32-754.el6.x86_64 ro root=UUID=df249160-8b81-4a30-baf2-02a21a0c4add

vi /etc/sysconfig/selinux

SELINUX=disabled

 


fdisk 時出現 'Partition 1 does not end on cylinder boundary'

 

 * It is not outputted in executing fdisk command with -l option and -lu option in RHEL7.

LBA CHS