Difference between revisions of "Parted: Basic operations"
Jump to navigation
Jump to search
(Created page with "== Launch parted and select disk == Launch <code>parted</code> by typing parted from the bash prompt: <syntaxhighlight> [root@localhost ~]# parted GNU Parted 2.1 Using /dev/sda Welcome ...") |
|||
| (One intermediate revision by one other user not shown) | |||
| Line 35: | Line 35: | ||
(parted) mkpart primary 0.00TB 3.00TB | (parted) mkpart primary 0.00TB 3.00TB | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | The syntax for the above is <code>mkpart <start position> <end position></code> | + | The syntax for the above is <code>mkpart <label> <start position> <end position></code> |
| + | |||
| + | == Display partition table == | ||
| + | <syntaxhighlight> | ||
| + | (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 | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | == Exit parted == | ||
| + | <syntaxhighlight> | ||
| + | (parted) quit | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | == Partition Alignment == | ||
| + | * Ensure the partitions are optimally aligned for performance tests | ||
| + | * Being lazy will result in misaligned partitions regardless of what numbers you use | ||
| + | <syntaxhighlight> | ||
| + | (parted) mklabel gpt | ||
| + | (parted) mkpart primary 0 100% | ||
| + | Warning: The resulting partition is not properly aligned for best performance. | ||
| + | Ignore/Cancel? | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | Use the following (in this example we are creating 3 partition on the volume) | ||
| + | <syntaxhighlight> | ||
| + | [root@localhost ~]# parted -a optimal /dev/sda | ||
| + | GNU Parted 2.1 | ||
| + | Using /dev/sda | ||
| + | Welcome to GNU Parted! Type 'help' to view a list of commands. | ||
| + | (parted) unit % mkpart primary 0% 33% | ||
| + | (parted) unit % mkpart primary 33% 66% | ||
| + | (parted) unit % mkpart primary 66% 100% | ||
| + | (parted) print | ||
| + | Model: LSI MR9261-8i (scsi) | ||
| + | Disk /dev/sda: 100% | ||
| + | Sector size (logical/physical): 512B/512B | ||
| + | Partition Table: gpt | ||
| + | |||
| + | Number Start End Size File system Name Flags | ||
| + | 1 0.00% 33.0% 33.0% primary | ||
| + | 2 33.0% 66.0% 33.0% primary | ||
| + | 3 66.0% 100% 34.0% primary | ||
| + | |||
| + | (parted) align-check optimal 1 | ||
| + | (parted) align-check optimal 2 | ||
| + | (parted) align-check optimal 3 | ||
| + | </syntaxhighlight> | ||
Latest revision as of 14:05, 19 October 2014
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/sdbgiving 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.00TBThe 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 primaryExit parted
(parted) quitPartition Alignment
- Ensure the partitions are optimally aligned for performance tests
- Being lazy will result in misaligned partitions regardless of what numbers you use
(parted) mklabel gpt
(parted) mkpart primary 0 100%
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?Use the following (in this example we are creating 3 partition on the volume)
[root@localhost ~]# parted -a optimal /dev/sda
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit % mkpart primary 0% 33%
(parted) unit % mkpart primary 33% 66%
(parted) unit % mkpart primary 66% 100%
(parted) print
Model: LSI MR9261-8i (scsi)
Disk /dev/sda: 100%
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 0.00% 33.0% 33.0% primary
2 33.0% 66.0% 33.0% primary
3 66.0% 100% 34.0% primary
(parted) align-check optimal 1
(parted) align-check optimal 2
(parted) align-check optimal 3