Thursday, 6 August 2015

Managing Partition in Linux using Parted

Parted is another utility  for managing  hard in linux based os

Step 1:-  To check number of partition  in a hard disk
======

[root@desktop12 ~]# parted  /dev/sda print  
Model: ATA ST3160812AS (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  538MB   537MB   primary   ext4            boot
 2      538MB   79.2GB  78.6GB  primary                   lvm
 3      79.2GB  79.7GB  537MB   primary   linux-swap(v1)
 4      79.7GB  160GB   80.3GB  extended
 5      79.7GB  82.9GB  3221MB  logical
 6      82.9GB  137GB   53.7GB  logical
 7      137GB   137GB   105MB   logical   ext3
 8      137GB   137GB   524MB   logical   ext4
 9      137GB   138GB   524MB   logical   ext4
10      138GB   140GB   2147MB  logical   ext4
11      140GB   140GB   105MB   logical
12      140GB   140GB   41.9MB  logical
13      140GB   141GB   524MB   logical
14      141GB   143GB   2147MB  logical   ext4

OR
==

[root@desktop12 ~]# parted  /dev/sda 
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: ATA ST3160812AS (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  538MB   537MB   primary   ext4            boot
 2      538MB   79.2GB  78.6GB  primary                   lvm
 3      79.2GB  79.7GB  537MB   primary   linux-swap(v1)
 4      79.7GB  160GB   80.3GB  extended
 5      79.7GB  82.9GB  3221MB  logical
 6      82.9GB  137GB   53.7GB  logical
 7      137GB   137GB   105MB   logical   ext3

Step 2: To show create  a new  logical partition 
===================================================

Inside your  hard disk create partition of  2GB

(parted) mkpart  logical  143GB   145GB

Note: quit to exit from partition table

fire partx command to 
[root@desktop12 ~]# partx  -a /dev/sda

step 3: create file system  of desired format 
=============================================

[root@desktop12 ~]# mkfs.vfat   /dev/sda15

step 4: Now mount your partition 
=================================
[root@desktop12 ~]# mkdir  /media/kkk
[root@desktop12 ~]# mount  /dev/sda15  /media/kkk

Now you can save your data and can also made entry in /etc/fstab to make this partition persistance
 
Article Source - http://www.rhce.co.in/managing-partition-in-linux-using-parted/ 

No comments:

Post a Comment