From charlesreid1

Revision as of 09:25, 5 December 2010 by Admin (talk | contribs) (Created page with "Gparted is a unix utility that can be used to deal with partitions and disks. Most gparted commands require superuser permissions, so it can be started using the <code>sudo part...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Gparted is a unix utility that can be used to deal with partitions and disks.

Most gparted commands require superuser permissions, so it can be started using the sudo parted command, which will run gparted and provide a (parted) prompt:

$ sudo gparted

(parted)

Command line usage

Showing disk information

The list of devices can be shown using the print command:

(parted) print all

Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size    Type     File system  Flags
 1      32.3kB  839MB  839MB   primary  linux-swap        
 4      839MB   199GB  198GB   primary  ext3              
 3      199GB   225GB  26.2GB  primary  ext3              
 2      225GB   250GB  25.0GB  primary  ext3         boot 

Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      32.3kB  1000GB  1000GB  primary  fat32

This scenario has two disks in the system:

  • A 250 GB ext3 hard drive (this is the main hard drive, and has four partitions, with one main partition - the 839MB-199GB partition)
  • A 1 TB fat32 hard drive (this is an external drive, since there is no boot or swap partition)

The main hard drive is the device /dev/sda, and the external hard drive is /dev/sdb. Further external hard drives would be labeled /dev/sdc, /dev/sdd, etc.

The device location is important, since it can be used to mount disks like this:

# For fat32 drives, specify uid and gid to allow read/write permission
mount /dev/sdb1 /path/to/mount/point -o user,rw,uid=userid,gid=groupid

# For ext3 drives, use chown and chgrp to add read/write permission
mount /dev/sdc1 /path/to/mount/point -o user,rw
chown userid /path/to/mount/point
chgrp groupid /path/to/mount/point