Increase or Decrease the Size of Static Partition in Linux.

No alt text provided for this image

Everyone think that a static partition cannot be increased but there's a trick to do it.

What is a static partition?

Static(Fixed) Partitioning:

->According to geek for geeks

This is the oldest and simplest technique used to put more than one process in the main memory. In this partitioning, a number of partitions (non-overlapping) in RAM is fixed but the size of each partition may or may not be the same. As it is a contiguous allocation, hence no spanning is allowed. Here partition is made before execution or during system configure.

No alt text provided for this image

As illustrated in the above figure, the first process is only consuming 1MB out of 4MB in the main memory.

Hence, Internal Fragmentation in the first block is (4–1) = 3MB.

Sum of Internal Fragmentation in every block = (4–1)+(8–7)+(8–7)+(16–14)= 3+1+1+2 = 7MB.

Suppose process P5 of size 7MB comes. But this process cannot be accommodated in spite of available free space because of contiguous allocation (as spanning is not allowed). Hence, 7MB becomes part of External Fragmentation.

Static V/S Dynamic Partitioning

?????♀?In most cases, we can use dynamic partitioning. It provides us a lot of flexibility. The following table will help you understand the difference between Static and dynamic partitioning.

There are some advantages and disadvantages of fixed partitioning.

Advantages of Fixed Partitioning –

  1. Easy to implement:
  2. Algorithms needed to implement Fixed Partitioning are easy to implement. It simply requires putting a process into certain partitions without focussing on the emergence of Internal and External Fragmentation.
  3. Little OS overhead:
  4. Processing of Fixed Partitioning requires lesser excess and indirect computational power.

Disadvantages of Fixed Partitioning –

  1. Internal Fragmentation:
  2. Main memory use is inefficient. Any program, no matter how small, occupies an entire partition. This can cause internal fragmentation.
  3. External Fragmentation:
  4. The total unused space (as stated above) of various partitions cannot be used to load the processes even though there is space available but not in the contiguous form (as spanning is not allowed).
  5. Limit process size:
  6. Process of size greater than the size of the partition in Main Memory cannot be accommodated. The partition size cannot be varied according to the size of the incoming process size. Hence, the process size of 32MB in the above-stated example is invalid.
  7. Limitation on Degree of Multiprogramming:
  8. Partitions in Main Memory are made before execution or during system configure. Main Memory is divided into a fixed number of the partition. Suppose if there are
  9. partitions in RAM and
  10. are the number of processes, then
  11. the condition must be fulfilled. The number of processes greater than the number of partitions in RAM is invalid in Fixed Partitioning.

Let’s move towards practical part????

First of all, we focus on the agenda:

  1. Attach a disk with OS
  2. Create partition
  3. Increased that parttion

To perform the whole particle we need to follow the steps given below:

Step 1: Add a Hard disk of any size

We will start by adding a hard disk to an existing virtual machine. In the settings of the VM go to storage and add a hard disk of the desired size. I added a Hard Disk of 15 GB. Following are the images of the steps to follow while adding the disk.

  • Add a Hard Disk


No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
  • Again tap next
No alt text provided for this image

Now give a name to your new H.D & specify a size you wish for it.

No alt text provided for this image
  • Here our H.D is created but still, it is not attached to our VM or RHEL8 O.S.


No alt text provided for this image
No alt text provided for this image
  • Attach the not attached harddisk.

To attach just click on choose that’s it our H.D name & size you specified will pop-up there tap ok! as you can see in above snapshot.

To Check & verify new H.D attached or not use the below command

fdisk -l
No alt text provided for this image
  • Output:

For the partition, we have to go in the /dev/sdd. Follow the below commands to create partitions.

After you reach inside the disk then follow the steps given below

  1. Type ’n’ to create a new partition.
  2. Specify where you would like the partition to end and start. You can set the number of MB of the partition instead of the end cylinder. For example +1000M(in my case it is +3G)
  3. After here you think why one extra option ‘Y” comes up so don’t worry if you do partition the first time then this option will not have come.
  4. Type ‘p’ to view the partition, and type ‘w’ to save the partition
No alt text provided for this image
fdisk /dev/sdd

2.b: Format the partition

Now that we have created a partition we have to format the partition that we have created. For that we can use the below command:

mkfs.ext4 /dev/sdd
No alt text provided for this image

2.c: Creating the mount point

After we successfully format the partition now we have to mount it to a directory. So first we need to create a directory. To create a directory using the below command:

mkdir (directory_name)

2.d: Mount the disk

Now after creating the directory we have to mount the created partition to the directory by using the below command and in order to check, we can use lsblk command as follows:

mount /(partition)/(dir name)
No alt text provided for this image

Now we are done with mounting. Let's keep some test files in the directory created so that we can prove that the data isn't affected by the increase or decrease of partition.

Step 3- Unmount the Created Partition

Now we will unmount the created partition for that we will use the below command

umount (mount_point_dir name)

In order to check whether the unmount is successful we will use the df -hT command:

df -hT
  • Output
No alt text provided for this image

After that , the partition wont be listed

→Re-partitioning disk

Inorder to increase size we need to make a new partition of the size of our choice

Use the below options:

n → to create a partition

p → for primary partition

→Now testing the Format:

e2fsmck -f <disk_name>

→Resizing:

By follow the above steps , so far we will increased the size but this is still unformatted , so we must re-format it , this is done using:


resize2fs <disk_name>

And the partitioning is done , Now we can re-mount it:

Doing so , we can increase and decrease the storage capacity of static partitions in Linux systems

Thank You........






要查看或添加评论,请登录

Abhishek Kumar Singh的更多文章

  • Apache Kafka: Understanding Key Concepts and Components.

    Apache Kafka: Understanding Key Concepts and Components.

    In this blog, we will explore Apache Kafka, the industry-leading platform for real-time data streaming. We will take a…

  • Research for Industry Use-Cases of Openshift.

    Research for Industry Use-Cases of Openshift.

    Research for industry use cases of Openshift and create a blog, Article or Video elaborating how it works. OpenShift is…

  • ?How We Can Contributing Limited Amount of Data-Node Storage to Hadoop Cluster

    ?How We Can Contributing Limited Amount of Data-Node Storage to Hadoop Cluster

    ??Tasks?? ??Let’s research and the world the know about the Myths of Hadoop?? Task 4.1 :- Individual/Team task: ??In a…

  • ARTH - Task 29 ??????

    ARTH - Task 29 ??????

    Task Description?? ??? Research for industry use cases of Jenkins and create a blog, Article or Video elaborating how…

  • Industry Use Cases of Neural Networks

    Industry Use Cases of Neural Networks

    What is Neural Networks? The computing systems inspired by biological neural networks to perform different tasks with a…

  • RESEARCH ON KUBERNETES USE CASE

    RESEARCH ON KUBERNETES USE CASE

    We all know how important Containers have become in today’s fast-moving IT world. Pretty much every big organization…

  • How industries are solving challenges using Ansible?

    How industries are solving challenges using Ansible?

    Before the invention of ansible there are many Automation tools used in the industry for solving all use cases so how…

  • Benefits Provided By AI & ML in Current Scenario...

    Benefits Provided By AI & ML in Current Scenario...

    Artificial intelligence is moving forward, and whether we like it or not, machine learning will play an essential role…

  • Docker+HTTPD+Python

    Docker+HTTPD+Python

    This Blog is about: Installing and Setting up Docker Running a Docker Container with Exposed Port Setting up httpd…

  • Automating LVM Partition using Python-Script

    Automating LVM Partition using Python-Script

    Automation include higher production rates and increased productivity, more efficient use of materials, better product…

社区洞察

其他会员也浏览了