Pejman Moghadam / Redhat

Redhat 8.0 - Managing disk partitions using "parted"

Public domain


Intstallation

rpm -ivh parted-1.4.24-6.i386.rpm

Creating a partition

1- Boot your system in rescue mode. When prompted to mount the file system, select Skip.

2- Making the partition :
 # parted /dev/hda
  (parted) print (display the partition table)
  (parted) mkpart logical ext3 14605 17605 (3GB)
  (parted) print (remember minor number of new partition)
  (parted) quit
 #exit (reboot)

3- Make sure the kernel recognizes the new partition:
  # cat /proc/partitions

4- Formating the partition :
 # mkfs -t ext3 /dev/hda8

5- Labeling the partition :
 # e2label /dev/hda8 /storage

6- Creating the mount point :
 # mkdir /storage

7- Add to /etc/fstab :
 LABEL=/storage /storage ext3 defaults 1 2

8- reboot

Removing a partition

1- Boot your system in rescue mode. When prompted to mount the file system, select Skip.

2- Deleting the partition :
 # parted /dev/hda
  (parted) print
  (parted) rm 8
  (parted) print
  (parted) quit
 # exit

3- Again boot your system in rescue mode. When prompted to mount the file system, select continue.

4- Remove corresponding line from /etc/fstab :
 # chroot /mnt/sysimage
 # vi /etc/fstab (delete corresponding line)
 # exit (exit chroot)
 # exit (reboot)

5- Make sure the kernel knows the partition is removed:
 # cat /proc/partitions

Resizing a partition

1- Boot your system in rescue mode. When prompted to mount the file system, select Skip.

2- Resize the partition :
 # parted /dev/hda
  (parted) print
  (parted) resize 8 14605 19605
  (The used space of the partition to resize must not be larger than the new size.)
  (parted) print
  (parted) quit
 # exit

3- Make sure the partition was mounted and is recognized with the new size :
 # df -h

BY: Pejman Moghadam
TAG: parted, partitioning, fstab
DATE: 2007-09-24 13:25:36


Pejman Moghadam / Redhat [ TXT ]