8 月 212012
 

原文(source): Converting from MBR based partitioning to GPT (GUID Partition Table) while online | NoSQL

CentOS has a bad tendency to install msdos partition table instead of GPT, which causes problems if you want partitions larger than 2 TB.

This is how I converted from MBR to GPT. It’s worked for me several times, but I wont give out any guarantees, so make sure you’re backed up if you have important data on the disks.

The following is the excerpt from parted /dev/sda:

(parted) unit s
(parted) print
Model: LSI 9750-8i DISK (scsi)
Disk /dev/sda: 5859352576s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 2048s 102402047s 102400000s primary ext4 boot, raid
2 102402048s 122882047s 20480000s primary linux-swap(v1)

(parted) mklabel gpt
Warning: Partition(s) on /dev/sda are being used.
Ignore/Cancel? ignore
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do
you want to continue?
Yes/No? yes
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy).
As a result, it may not reflect all of your changes until after reboot.

(parted) mkpart primary ext4 2048s 102402047s
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy).
As a result, it may not reflect all of your changes until after reboot.

(parted) mkpart primary linux-swap 102402048s 122882047s
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy).
As a result, it may not reflect all of your changes until after reboot.

(parted) print
Model: LSI 9750-8i DISK (scsi)
Disk /dev/sda: 5859352576s
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 2048s 102402047s 102400000s ext4 primary
2 102402048s 122882047s 20480000s linux-swap(v1) primary

As you can see I just created the same partitions in the GPT table.

Step two was to run grub-install /dev/sda and then reboot the server.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

CAPTCHA Image
Play CAPTCHA Audio
Reload Image