How to create file system in Linux

Published by RSY Digital World on

RSY Digital World Logo

How to create file system in linux

Scenario : Many time server admins have request to create new file system on request from application team or during server provisioning. So lets see how to create file system in linux under different scenario.

Exp:Create File System of 500GB with mount point /u001 under oracledg.

Solution

Lets start diving about scenario in how to create file system in linux . We will have two scenario in this case either it will be LVM based or it will be on veritas  based.

Case 1 . How to create file system in linux under VxVM
Lets assume in this case when you validated and found disk group is having enough disk space
to create new file system in it.In interest to save time to go through same process again and
again would like to mention use below link.In case if you want to know how we can add space in
disk group and extend file system in linux. You can refer to below blogs to understand .
Will add link below about the same if interested can have a look into it.
How to expand FS in RHEL
1.  Validate if required mount point does not exists already.
# df -h /u001 // It will not show any output as there is no such FS exists already. //
2. You must have identified disk group you are going to create new FS.
# vxassist –g oracledg maxsize    
// Run above command to see if enough space is there to create new file system.
Output will be in MB get it converted into GB and it must be more than required 
space to provision new FS.//
3. Create Volume in Disk Group
# vxassist -g oracledg  fsgen make u001 500g
//This will create a new volume name of u001 of 500GB.//
4.Create File System on new volume created
# mkfs -t vxfs -o largefiles /dev/vx/rdsk/oracledg/u001
5. Create Mount Point and change permissions
# mkdir /u001 
# chmod 755  /u001
# chown oracle:oracle /u001
6. Update fstab so that it gets mounted across reboot.
7. Mount it using either of below
# mount -t vxfs /dev/vx/rdsk/oracledg/u001 /u001
# mount /u001
# mount -a

That,s it.You are done.

Case 2 . How to create file system in linux under LVM
Lets assume in this case also when you validated and found volume group is having enough disk
space to create new file system in it.In interest to save time to go through same process again
and again would like to mention use below link.
In case if you want to know how we can add space in volume group  and extend file system in 
linux. You can refer to below blogs to understand .Will add link below about the same if 
interested can have a look into it.
How to expand FS in RHEL
So lets continue
1.  Validate if required mount point does not exists already.
# df -h /u001                                              
// It will not show output as there is no such File System exists already. //
2. You must have identified volume group you are going to create new FS.
# vgdisplay oraclevg
//Look for space available in volume group in output of above command.// 
3. Create Logical Volume
# lvcreate -L 500G -n oracle oraclevg
//This will create new volume group of 500GB.//
4. Making File System on new volume
# mkfs.ext4 -m 0 /dev/oraclevg/oracle
5. Updating fstab in below format to make sure availability across reboots.
/dev/oraclevg/oracle /u001 ext4 defaults 0 2
6.Mount Point Creation & permission setting
# mkdir /u001
# chmod 755 /u001
# chown oracle:oracle /u001
7. Mounting FS
# mount -a            OR   # mount /u001

That,s it.You are done.

So i hope you have enjoyed procedure how to create file system in linux and find it useful.If you like the procedure request you to share as much as you can and if interested in learning more tips and tricks related to unix linux cloud etc please join our FB group with link below.

Join our FB group 

More linux related resources are below as well you can see to increase your level of expertise in linux.

Linux/UNIX Resource Center on PEARSON InformIT.com
InformIT eBook Store
InformIT LiveLessons Series


RSY Digital World

RSY Digital World Founder & [email protected] Digital World. A UNIX Linux expert having a more than 20 years of experience in Solaris Red Hat Linux HP-UX AIX Unixware Open Server Veritas Storage Cloud Bigdata and many more in UNIX LINUX Infrastructure technologies.

0 Comments