Parted: Basic operations

From Define Wiki
Revision as of 14:39, 21 September 2012 by Jon (talk | contribs)
Jump to navigation Jump to search

Launch parted and select disk

Launch parted by typing parted from the bash prompt:

[root@localhost ~]# parted
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

Select disk by entering the device name, eg. /dev/sdb:

(parted) select /dev/sdb

giving the following output:

GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

Changing the partition table to GPT to support partitions >2TB

(parted) mklabel gpt
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted)

Set units to TB and create partition

(parted) unit TB
(parted) mkpart primary 0.00TB 3.00TB

The syntax for the above is mkpart <label> <start position> <end position>

Display partition table

(parted) print
Model: ATA ST33000651AS (scsi)
Disk /dev/sdb: 3.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system  Name     Flags
 1      0.00TB  3.00TB  3.00TB  ext4         primary

Exit parted

(parted) quit