cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a new partition

SOLVED
Go to solution
Sunil Sharma_1
Honored Contributor

How to add a new partition

Hi,

I am having Red hat Linus 8.0.
i have free space on disk and i want to create a new File system on this.
How can i do it ?
please give me step by step process with commands.

Thanks
Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
7 REPLIES
Steven E. Protter
Exalted Contributor

Re: How to add a new partition

I think this is the best guide.
http://www.linux.org/docs/ldp/howto/Filesystems-HOWTO-6.html

Theory, how to extend a filesystem.
http://tldp.org/HOWTO/Filesystems-HOWTO-6.html

This manual almost everything you need.
http://www.cslab.vt.edu/manuals/parted-1.6.1/html_mono/parted.html

Example, growing a partition ext2
http://www.cslab.vt.edu/manuals/parted-1.6.1/html_mono/parted.html#SEC30


More...
http://lists.suse.com/archive/suse-linux-e/2002-Oct/1988.html

You don't mention whether you are using lvm or not. If you are using lvm its just like HP-UX(checked out your profile)

umount
lvextend
extendfs

If not the links are good.

sEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sergejs Svitnevs
Honored Contributor

Re: How to add a new partition

To partition a disk use fdisk
#fdisk /dev/hda
n - add a new partition
w write table to disk and exit

The new table will be used at the next reboot.
#reboot

To create a filesystem use mkfs.
Making file system named "/home_new" on hdb1
# mkfs -V -t ext3 -L /home_new /dev/hdb1

To mount a filesystem change fstab.
#vi fstab
/dev/hdb1 /home_new ext3 defaults 1 2

Mount all filesystems (of the given types) mentioned in fstab.

#mount -a

Regards,
Sergejs
Evert Jan van Ramselaar
Valued Contributor

Re: How to add a new partition

To create a new partition, use
# fdisk /dev/hdx
if you have unpartitioned space on hdx.
Option n will guide you through making it.
Option w will write your new partition table to disk.

You may have to reboot before you can perform the next steps.

To create a filesystem on the new partition, use
# mkfs /dev/hdxn
where hdxn is the new partition, ie. hda6.

After this step, you can mount the newly created filesystem, with
# mount /dev/hdxn /mountpoint

Remember to create the mountpoint directory first. You might want to add the new filesystem to /etc/fstab.

For detailed info, see manpages for fdisk, mkfs and mount.

EJ
Contrary to popular belief, Unix is userfriendly. It just happens to be selective about who it makes friends with.
Umapathy S
Honored Contributor
Solution

Re: How to add a new partition

Sunil,
I will add little more to the details. Just now I finished creating one!!

Before creating a new partition print the info with p. Make sure you start with the correct cylinder. fdisk will give you the first and last cylinder. Calculate it w.r.t your requirements.

You can also use mke2fs. Check the man pages for more info.

HTH,
Umapathy


Arise Awake and Stop NOT till the goal is Reached!
Sunil Sharma_1
Honored Contributor

Re: How to add a new partition

Hi,
Thanks to all of you.
but small doubt remains
is it necessary to rebbot after creation of new partition ?

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
Umapathy S
Honored Contributor

Re: How to add a new partition

Sunil,

This is from man fdisk


A sync() and a BLKRRPART ioctl() (reread partition table from disk) are performed before exiting when the partition table has been updated. Long ago it used to be necessary to reboot after the use of fdisk. I do not think this is the case anymore - indeed, rebooting too quickly might cause loss of not-yet-written data. Note that both the kernel and the disk hardware may buffer data.


So I dont think it is necessary to reboot.

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Sunil Sharma_1
Honored Contributor

Re: How to add a new partition

Thanks Uma.

*** Dream as if you'll live forever. Live as if you'll die today ***