e42.uk Circle Device

 

Quick Reference

GNU Parted Simple Tutorial

GNU Parted Simple Tutorial

Just an easy little tutorial to demonstrate how to create a partition table on an empty drive... or overwrite one on an old drive

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

First let's see what is on the disk already

(parted) print
Error: /dev/sdc: unrecognised disk label
Model: ATA ST3500418AS (scsi)                                             
Disk /dev/sdc: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 
(parted)

Create Partition Table

Make a partition table (here I will make a standard MSDOS partition table

(parted) mklabel msdos
(parted)

Great, now a primary partition for the full size of the disk, I also want it to be a Linux partition. Then to check that it is optimally aligned. Oh, and make it bootable.

(parted) mkpart primary ext3 2M 499G
(parted) align-check opt 1
1 aligned
(parted) set 1 boot on
(parted) 

Now then... check that everything is as we expect

(parted) print                                                    
Model: ATA ST3500418AS (scsi)
Disk /dev/sdc: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      2097kB  499GB  499GB  primary  ext3         boot, lba

(parted)  

Excellent! Now quit and try to mount the partition

(parted) quit

All is well, and we used parted rather than fdisk.

Quick Links: Techie Stuff | General | Personal | Quick Reference