How to increase file system in linux
This is most common kind of request an unix linux administrator go though regardless of technology advancement and inclusion of cloud technologies.How to increase File System in Linux.
Most of the cloud service providers are focusing on IAAS infrastructure as a service in which still infrastructure has to be maintained by organizations so this topic still have relevance.So would like to share details on old topic on linux.
You have to expand File Systems either in RHEL. Your environment may based on either Veritas Volume Manager or on LVM.
So lets discuss about all the possibilities/scenario related to file systems expansions across linux.
High Level plan will be like below.
1. Validate/Identify Operating System your server is running.
2. Verify what utilities you are using to maintain your file systems on these servers.
3. Verify if space already exists and you can directly go for file system expansion online anytime.
4. Verify and expand FS if space is not available.See how below.
Do not feel overwhelmed it is quite simple but we are trying to address everything related to it so it may look long but it,s really not.Once you are familiar with it ,this task will be easiest one to handle.
So lets start with validations first.
1. Validations of the Operating Systems
There may be two scenario here.Considering the fact most of the admins must be aware about the same but mentioning here some basic commands to validate if your server is linux servers considering it may be helpful for freshers or new joiners in any organizations.
How to identify OS
Step 1 : First of all login to the server using tool what ever you have .Putty is freeware tool to login.
Step2 : You can run below commands to verify what operating system you have on server.
# uname –a //It runs on both solaris or linux. From output you can easily verify what it is running.
Linux server011 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release //This will work on RHEL servers and clearly tells about the RHEL version.
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
So now you have fair idea what operating system is available on server where you have to extend FS. Now lets move to validate what are the utility software is running on servers where you have to extend FS. 2.How to identify environment There will be two possibilities here .It may be either of below 1. It may be FS is managed by Native LVM [Logical Volume Manager] on RHEL. 2. It may be Veritas Volume Manager is being used for FS management on RHEL. Here Native LVM/SVM referred as Delivered with OS without any additional cost by OEM vendors. # df -h //This command will work on both and display FS layout from where you can easily verify depending upon layout and some identification like is mount point like below.// RHEL LVM based formats are : /dev/sdx,/dev/mapper/,/dev/mapper/vgname,/dev/cciss/, /dev/md RHEL VxVM format will be like /dev/vx/dsk/<dgname>/<volumename>. # cat/more /etc/fstab //RHEL permanent file system table consistent across reboots. # cat/more /etc/vfstab //Solaris permanent file system table consistent across reboots.
Considering above format mentioned you can easily identify what is your current env.
3. Validate and Expand FS (If space already exists)
Now let’s see if space is already there in respective DG or VG and we can expand FS online.
How to extend file system in linux if space already present in [VG] or [DG]
For LVM Environment
1.First do # df –h /MountPoint and save current FS status before expansion as proof either manually by copying output to any text file or save output to system like below. More importantly here you will find the name of VG and volume name which needs to be expanded. # df –h /MountPoint > /var/tmp/df-h.ddmmyyyy //Save current FS status// 2.# vgdisplay <DGName> //If LVM based,look for free space in VG// 3.# lvextend –L +50G <LV Name> //This will extend FS by 50GB.// 4.# resize2fs <LV Name> //This will bring change in lv into active state.// 5.# df –h /MountPoint
//You are done , you can compare current output with saved one to be sure before sending confirmation to requester.//
For VxVM Environment
1.First do # df –h /MountPoint and save current FS status before expansion as proof either manually by copying output to any text file or save output to system like below. More importantly here you will find the name of DG name and volume name which needs to be expanded. # df –h /MountPoint > /var/tmp/df-h.ddmmyyyy //Save current FS status// 2.# vxassist –g <DGname> maxsize //This will provide available space in MB which you can convert in Diskgroup by dividing output by 1024 to get available disk space in GB.// Then extend FS as below 3.# vxresize –g <DGname> <VOLName> +50g 4.# df –h /MountPoint
//You are done; you can compare current output with saved one to be sure before sending confirmation to requester.//
4.Validate and Increase File System in Linux (If space is not there)
Hmm.. Now we have situation that FS expansion requested and you came to know VG or DG does not have enough space. You can refer steps mentioned above how to validate if space is available or not.
You need to submit request to your organizations storage team to provide new disk assigned to specified server to fulfill your request. Storage team provide disks they called it LUN (Logical Unit Number ) from installed storage units for organization.
It may be either EMC Storage, Hitachi Storage,3Par Storage, HP Storage, IBM Storage or even NetApps Storage.
You need to submit request to storage team and mainly they will ask to provide WWN (World Wide Number ) which is logically 132 bit H/W address of HBA card installed in server. It could be challenging to find WWN sometimes.
Need any kind of help regarding this ?
I have already posted another detailed writing regarding this. You can have a look to understand how to get WWN number. It is quite easy. For easy reference I will put text link below.
So let’s suppose you have requested storage and they have provided storage to expand FS as per request. Now you have to go through below steps .
High Level tasks for how to increase file system in linux will be….
1. First need to make our OS can see the disk and format it to use ready. 2. Extending VG and LV in case of RHEL. 3. If VxVM is present need to make sure VERITAS can see the disk,i mean VERITAS needs to take control of disk in it to use with VERITAS. 4.Extend DG and extend VOL as required. 5.Validate and update requester.
So lets start,,,,
There may be many methods how you are going to scan the new lun to linux servers. There are even scripts available on net or traditional >>> method or if tg3 package is installed in server. If not there you can install it using yum. I am mentioning this whatever environment i have there all servers are present with tg3 package.
You can validate using rpm –qa command to see if it is present in your server.
So this package serves script which works perfectly ,i have used this over many years without any failure. In my environment Emulex HBA is being used.
For Veritas 1.# /usr/sbin/lpfc/lun_scan all //This will scan all the controllers mostly 2 and disks recognized to RHEL seamlessly.// 2.# vxdctl enable //Once disk is recognized with RHEL we need not to take action like labeling in solaris. We can directly initialize VERITAS daemon to get recognized to VERITAS. This will initialize the VERITAS daemon which will recognize if any new disk has been presented.// 3.# vxdisk list //This will provide all the disk lists which is under control of VERITAS. Please find out diskname newly added you can match this with the details provided by storage team. They must have sent disk details to you or your team when they assigned.// 4.# vxdisksetup –i <DAName> //This will initialize the disk and write veritas VTOC/metadata on disk like private and public regions etc.// 6.# df –k /MountPoint //You need to have this output handy which will have diskgroup name and volume name as well which needs to be expanded.// 7.# vxvol –g <DG> adddisk DiskName=DAName //This will add disk to the diskgroup. DiskName must be unique in diskgroup .// 8.# vxassist –g <DG> maxsize //This will display how much space is there after adding the new disk in MB.Convert it by dividing 1024 to get space in GB.// 9.# vxresize –g <DG> <VOL> +XXXg //This will extend the FS with required additional space added.// 10.# df –h /MountPoint //You are done, you can see the increased space compare it with old output before confirming to the requester.//
For LVM 1.# /usr/sbin/lpfc/lun_scan all //This will scan all the controllers mostly 2 and disks recognized to RHEL seamlessly.// 2.First do # df –h /MountPoint and save current FS status before expansion as proof either manually by copying output to any text file or save output to system like below. More importantly here you will find the name of VG and volume name which needs to be expanded. # df –h /MountPoint > /var/tmp/df-h.ddmmyyyy //Save current FS status// 2.# vgdisplay <VGName> //If LVM based,look for free space in VG// 3.# lvextend –L +50G <LV Name> //This will add 50GB to LV.// 4.# resize2fs <LV Name> //This make sure lvextend result parsed to FS.// 5.# df –h /MountPoint //You are done , you can compare current output with saved one to be sure before sending confirmation to requester.//
Let me ask for small push, if you like the work and not having any concern to join or subscribe.
Please do join our Facebook Group and do have a look on our blogs to get more technical tips related to UNIX LINUX Cloud and more and increase your technical efficiency to perform better in your current and future role.Text Link is given below.Join FB group using this .