How To: Create a partition in Redhat Linux

By | 22/05/2012

To see all available partition, use the below command

#fdisk -l

#fdisk /dev/sda

command: n ( for new partition)

we can create primary partition or extended

  • If the hard disk is new / having 2 or 3 primary partitions , then only options of “what of disk have to be created whether primary or extended ?” available.
  • If already extended partition is created, then newly created partition will created default as logicla drive.

We don’t know about cylinder size, so leave it just give enter

First cylinder:

Last cylinder or + size: +100M

Give value in MB’s followed by +, the above given size is 100MB

Dont give any value, if you want to extent the whole available space

 

After creating the partition, we have to save give “w” to save. If we exit without saving, then created partition will not available. we have to create that partition once again.

command: w

 

Without restarting our system, update the kernel about new partition has been added.

#partprobe

Refreshing

#sync

Partprobe and synchronous (sync) command can be give as joined command by

#partprobe | sync

 

Before accessing the partition, we have to format it with required file system.Without formatting, we can’t able to access our partition. Based on what file system we are using for formatting, that file system will be the partitions file system.

Example:

Here sda10 partition is created with ext3 file system.

#mkfs.ext3 /dev/sda10

 

As like windows operating system, we can’t access partition directly. We have to mount the partition in some directory

#mkdir /office det

#mount /dev/sda10 / /office det

To check whether partition is mount correctly, use this command

#df -h

 

The above mounting operation is temporary, when system restarted mount will be deleted. So make a permanent mount entry in

#vim /etc/fstab

Last line:

/dev/sda10 /office det ext3 defaults 0 0

Small recap

#fdisk /dev/sda

command: n

First cylinder : <just give enter>

Last cylinder or + size: +100M

#partprobe | sync

#mkfs.ext3 /dev/sda10

#mount /dev/sda10 /office

#vim /etc/fstab

Last line:

/dev/sda10 /office det ext3 defaults 0 0

How to give read only permission to a partition

/dev/sda10 is mount in /office directory

Give Read-Only permission to /dev/sda10 by setting permission for /office

#mount -o remount,ro /office

Giving Read-Write permission

#mount -o remount,rw /office

Post By prasad (110 Posts)

Website: →

Connect

About prasad

Prasad K has written 110 post in this blog.

Leave a Reply