In addition to gdisk, you can also use the parted command at the shell prompt to manage GPT partitions. You can use it to add, delete, and edit the partitions on your disk.
Unlike gdisk and fdisk, the parted command writes the partition changes you specify immediately to the disk. Be absolutely certain of the changes you want to make before using parted!
To use parted, enter parted at the shell prompt and then use the select command to specify which disk you want to manage. Be very careful, because if you don’t manually specify a disk to manage, parted will automatically select your first hard disk for you—you know, the one with your system partitions and your home partition on it? Accidentally deleting a partition on this disk could be bad! If you intend to work on a disk other than /dev/sda, be sure you use the select command.
After selecting the appropriate hard disk, you can create a new partition using the mkpart command at the parted prompt. You need to specify the following:
• The type of partition to be created For example, to create a standard Linux partition, you would specify a value of linux.
• The starting point on the disk for the partition (in megabytes) For example, to create a partition that starts at the 1GB point on the disk, you would specify a value of 1024.
• The ending point on the disk for the partition (in megabytes) For example, to create a partition that ends at the 11GB point on the disk, you would specify a value of 11264.
To view the partitions that have been created on the disk, you can use the print command at the parted prompt. In the following example, a 10GB partition is created on the second hard disk in the system (/dev/sdb):
openSUSE:~ # parted
GNU Parted 2.4
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sdb
Using /dev/sdb
(parted) mkpart linux 1024 11264
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 17.2GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1024MB 11.3GB 10.2GB linux
(parted)
You can also use the following commands at the parted prompt to manage disk partitions:
• To rename a partition, enter name partition name.
• To move a partition to a different location on the disk (which is a very handy thing to be able to do), enter move partition start_point end_point.
• To resize a partition on the disk (another very handy thing to be able to do), enter resize partition start_point end_point.
• To delete a partition from the disk, enter rm partition.
No comments:
Post a Comment