Sunday, 13 January 2013

How to mount ant partition on a Directory Step by Step

step 1 creat one  parttion :-
#fdisk -l

(check the HDD name)

#fdisk -c /dev/sda

(dev/sda is mine system name find yours and its commant to create the partition.)

#Press M for help

N (new Partition)

there is two option don't make it primary now

press E for extended

and after hit two time blank enter (dont change first time.)

after you can see there is 2 or 3 primary partition or of the last is extended with Press P for Print

now press again N for new partition

first blank enter

after that give the size of partition Syntex is like that: + 20G and enter you can also creat in K,M,G, (kb,mb,gb).

Now press p to print table see there is another partion which u make

now press W to save the partition

#partx -a /dev/sda

(to activate your partition and run this command two time.)

Note: This command is working only Rhel6 if you have any other then you can put this command

#partprobe /dev/sda

#mkfs.ext4 /dev/sda5

(format the partition make sure always define partition like /dev/sda5, sda6,)

#mkfs -t ext4 /dev/sda5

(also use to format with file system like ext2,ext3,ext4, )

#mkdir /data (make a directory.)

#mount /dev/sda5 /data

(this is temprery mount if can parmanent then make entry in vi /etc/fstab,)

#vim /etc/fstab

(go in this file and make this entry in insert mode for insert press i in the file)

/dev/sda5 /data ext4 defaults 0 0

press escape and :wq! (to save changes in the file.)


#mount -a (to activate the mount point.)


#mount (show all mount points.)


#df -TH (show all partition )


#du -sh /data (show only folder size.)

No comments:

Post a Comment