Skip to content

Parted

3TB Example

Linux Create 3TB partition size To create a partition start GNU parted as follows:

# parted /dev/sdb

Output:

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

Creates a new GPT disklabel i.e. partition table:

(parted) mklabel gpt

Sample outputs:

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)

Next, set the default unit to TB, enter:

(parted) unit TB

To create a 3TB partition size, enter:

(parted) mkpart primary 0.00TB 3.00TB

To print the current partitions, enter:

(parted) print

Sample outputs:

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

Quit and save the changes, enter:

(parted) quit

Sample outputs:

Information: You may need to update /etc/fstab.

Use the mkfs.ext4 command to format the file system, enter:

# mkfs.ext4 /dev/sdb1

LVM Setting

Syntax:

(parted) set [number] lvm [status]

Example:

(parted) set 1 lvm on

Check alignment

On an already partitioned disk, you can use parted to verify the alignment of a partition on a device. For instance, to verify alignment of partition 1 on /dev/sda:

# parted /dev/sda
(parted) align-check optimal 1
1 aligned

See also

Favorite site