GPT ?
AND
ggrks via UEFI
.
ggrks via Over 2TB limit
gdisk
fdisk
can not treat GPT, so user gdisk
GPT root disk
Amazon linux's root volume GPT
The Amazon linux's root volume is partined with GPT.
But EC2 not support uefi, so part #128 (disk 1st sector) should be BIOS boot partioion
.
https://forums.aws.amazon.com/message.jspa?messageID=553933
# gdisk /dev/xvda
GPT fdisk (gdisk) version 0.8.10
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk /dev/xvda: 62914560 sectors, 30.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 4FC1A985-701F-4614-A040-C7A5CFB924C6
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 62914526P
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 4096 62914526 30.0 GiB 8300 Linux
128 2048 4095 1024.0 KiB EF02 BIOS Boot Partition
Proc for amazon linux
- gdisk
# gdisk /dev/xvdf
GPT fdisk (gdisk) version 0.8.10
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}: +1M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): EF02
Changed type of partition to 'BIOS boot partition'
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-20971486, default = 4096) or {+-}size{KMGTP}:
Last sector (4096-20971486, default = 20971486) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): p
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): p
Disk /dev/xvdf: 20971520 sectors, 10.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): F992E234-8A2C-4E38-BCB3-F2F99CB98146
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 20971486
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 4096 20971486 10.0 GiB 8300 Linux filesystem
128 2048 4095 1024.0 KiB 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/xvdf.
The operation has completed successfully.```
-
mkfs & mount
-
copy files via dump & restore
cd <your mount point to target (shrunk) disk>
dump -0uf - /dev/sdc1 | restore rf -
- chroot (maybe vain..)
cd <your mount point to target (shrunk)>
mount -t proc proc ./proc
mount -t sysfs sys ./sys
mount --bind /dev ./dev
chroot .
- grub install
Amazon linux grub != grub2.grub-install
does not work correctly.
# grub
grub> device (hd0) /dev/sdf
device (hd0) /dev/sdf
grub> root (hd0,0)
root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... failed (this is not fatal)
Running "embed /boot/grub/e2fs_stage1_5 (hd0,0)"... failed (this is not fatal)
Running "install /boot/grub/stage1 (hd0) /boot/grub/stage2 p /boot/grub/grub.conf "... succeeded
Done.
grub> quit
quit
5') for CentOS6
edit boot/grub/grub.conf
& replace current disk-UUID.
To get disk-UUID
blkid /dev/sdf1
- unchroot (maybe vain...)
exit (chroot)
umount ./dev
umount ./sys
umount ./proc
umount <your mount point>
- e2label [your disk] /
e2label /dev/xvdf1 /