{"id":3229,"date":"2025-02-19T20:32:38","date_gmt":"2025-02-19T20:32:38","guid":{"rendered":"https:\/\/foghosting.com\/how-to-create-partitions-in-linux-fog-hosting\/"},"modified":"2025-02-19T20:32:38","modified_gmt":"2025-02-19T20:32:38","slug":"how-to-create-partitions-in-linux-fog-hosting","status":"publish","type":"post","link":"https:\/\/foghosting.com\/blog\/how-to-create-partitions-in-linux-fog-hosting\/","title":{"rendered":"How To Create Partitions in Linux? &#8211; Fog Hosting"},"content":{"rendered":"<div>\n<h2><span id=\"Introduction\">Introduction<\/span><\/h2>\n<p>Management is an essential component of control and productivity. In the world of computers, the control factor depends on the operating system. An operating system allows the user to take control of the computer, and Linux is an excellent example of this OS. It helps complete various computing tasks by managing the hardware and software components of the computer.<\/p>\n<p>Do you know the entire management task requires proper space on the disk? So, how does Linux manage this space allotment? The term \u201cpartitioning\u201d supports data organization. So, <strong>Linux creates partitions<\/strong> in order to manage the computer.<\/p>\n<p>In this article, we will discuss the important elements of partitioning in Linux. We will also discuss the importance of partitioning and<strong> how Linux creates partitions <\/strong>through the \u201cfdisk\u201d and \u201cparted\u201d commands. This informative piece will help you discover how to format and mount partitions, which are crucial steps to making partitions usable. Get ready to dive into the world of <strong>Linux disk partitioning<\/strong>!<\/p>\n<h2><span id=\"Why_Is_Partitioning_Important_for_a_Linux_Operating_System\">Why Is Partitioning Important for a Linux Operating System?<\/span><\/h2>\n<p>Data organization is important, regardless of its mode. Linux organizes data for a computer through the process of partitioning. Before we dig deeper into <strong>how Linux partitions<\/strong>, let\u2019s look at the importance of this process.<\/p>\n<h3><span id=\"Organizing_Data\"><strong>Organizing Data<\/strong>:<\/span><\/h3>\n<p>Partitions help in organizing data by separating different types of files and system areas. For example, you might have one partition for the operating system, another for user data, and another for system backups.<\/p>\n<h3><span id=\"Managing_Space\"><strong>Managing Space<\/strong>:<\/span><\/h3>\n<p>By partitioning a drive, you can allocate specific amounts of space for different purposes. This can help prevent the operating system from filling up all available space and keep data organized.<\/p>\n<h3><span id=\"System_Stability_and_Recovery\"><strong>System Stability and Recovery<\/strong>:<\/span><\/h3>\n<p>Keeping the operating system on a separate partition from user data can improve system stability and make it easier to recover data in case of a system failure or reinstall.<\/p>\n<h3><span id=\"Multi-Boot_Systems\"><strong>Multi-Boot Systems<\/strong>:<\/span><\/h3>\n<p>The partition approach is highly beneficial in cases of multi-OS requirements. Yes, a user can install multiple operating systems when <strong>Linux creates a partition<\/strong>.<\/p>\n<h3><span id=\"Performance_and_Security\"><strong>Performance and Security<\/strong>:<\/span><\/h3>\n<p>Different partitions can improve performance by reducing fragmentation and can enhance security by isolating sensitive files.<\/p>\n<h3><span id=\"System_Recovery\"><strong>System Recovery<\/strong>:<\/span><\/h3>\n<p>Assume there is a box with four separations. Each separation has a different spice power. Now, by mistake, water gets spilled in one of the separate parts. Will the other three separations get wet? The answer is no because there is a clear separation in the box. In a very similar way, a partition on a system saves the data and allows for quick recovery.<\/p>\n<p>Do you know that Linux without disk partition implementation can be risky for data? Yes, it can lead to data loss or very low flexibility in system organization. Hence, it is highly important to <strong>create a partition in Linux<\/strong>.<\/p>\n<h2><span id=\"Partition_Disk_Using_The_fdisk_Command\">Partition Disk Using The fdisk Command<\/span><\/h2>\n<p>The fdisk command is the most appropriate choice when a user sets up a new disk in Linux. Go through the following steps to use the<strong> fdisk command to create a partition:<\/strong>.<\/p>\n<h3><span id=\"Step_1_List_Available_Disks\">Step 1: List Available Disks<\/span><\/h3>\n<p>Many systems have multiple disks. As a user, you don\u2019t want to confuse them. So, the very first step is to list the available disks to identify the right one.<\/p>\n<pre><code>sudo fdisk -l<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Step_2_Start_fdisk_on_the_Target_Disk\">Step 2: Start fdisk on the Target Disk<\/span><\/h3>\n<p>Once the right disk has been identified, the next step is to start the fdisk command on it. In order to do so, you will have to use the following command.\u00a0<\/p>\n<pre><code>sudo fdisk \/dev\/sdb<\/code><\/pre>\n<figure><\/figure>\n<p>In the above command, the term \u201c\/dev\/sdb\u201d is generic. Here, you need to switch it with the correct disk identifier.\u00a0<\/p>\n<h3><span id=\"Step_3_View_Existing_Partitions\">Step 3: View Existing Partitions<\/span><\/h3>\n<p><strong>Creating partitions in Linux<\/strong> is a complex process if it is not done correctly. It is always advisable to check the existing partitions first. This leads to knowledge about the available disk space and the prevention of important data. Overall, it is a great way to prepare for backup. You can view the existing one by entering the following command:\u00a0<\/p>\n<pre><code>P<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Step_4_Create_a_New_Partition\">Step 4: Create a New Partition<\/span><\/h3>\n<p>Now, with all the information you have just gone through, you are ready to <strong>partition a disk in Linux<\/strong>. Implement the following command to do so:<\/p>\n<pre><code>n<\/code><\/pre>\n<figure><\/figure>\n<p>The creation process will begin when you enter the \u201cn\u201d command. Moving on, you will have to use the command below to select the partition type. The type usually indicates the role and usage of the partition. There are different types of partitions, including primary, extended, logical, and so on. Here, we will go with the primary partition.\u00a0<\/p>\n<pre><code>p<\/code><\/pre>\n<figure><\/figure>\n<p>The next thing to specify is the newly created separation with a number. This is important in order to create a unique identity. The common range of primary partitions is from 1 to 4. So, we will enter the number \u201c1\u201d in the command-line interface.\u00a0<\/p>\n<pre><code>1<\/code><\/pre>\n<figure><\/figure>\n<p>The last step in partition creation is related to size. You need to enter a specific number in the CLI in order to create a particular size of the partition. For example, here you can enter \u201c+20G\u201d in the CLI. Once you press enter, a 20-GB separation will be available for you.\u00a0<\/p>\n<h3><span id=\"Step_5_Write_Changes_to_the_Disk\">Step 5: Write Changes to the Disk<\/span><\/h3>\n<p>Now, the above changes are temporary until you write them with the following command:<\/p>\n<pre><code>W<\/code><\/pre>\n<figure><\/figure>\n<p>That\u2019s it; your partition in Linux is ready to use!<\/p>\n<h2><span id=\"Partition_Disk_Using_the_Parted_Command\">Partition Disk Using the Parted Command<\/span><\/h2>\n<p>The parted command is another tool for managing disk partitions in Linux, offering more advanced options than fdisk. Follow these steps to use the command \u201c<strong>parted\u201d to create a partition:<\/strong><\/p>\n<h3><span id=\"Step_1_List_Available_Disks1\">Step 1: List Available Disks<\/span><\/h3>\n<p>Just like how we first identified the existing partitions in the fdisk part, we will do the same here. This will help us identify the right disk for the process. You can do so by using the following command:<\/p>\n<pre><code>sudo parted -l<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Step_2_Start_the_Parted_Command_on_the_Target_Disk\">Step 2: Start the Parted Command on the Target Disk<\/span><\/h3>\n<p>Once you\u2019ve identified the correct disk, start the parted command for that disk. Replace \/dev\/sdb with your actual disk identifier. This step is also similar to the fdisk one.\u00a0<\/p>\n<pre><code>sudo parted \/dev\/sdb<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Step_3_View_Existing_Partitions1\">Step 3: View Existing Partitions<\/span><\/h3>\n<p>To see the existing partitions and available space, use the print command. This helps in understanding the current disk setup.<\/p>\n<pre><code>print<\/code><\/pre>\n<h3><span id=\"Step_4_Create_a_New_Partition1\">Step 4: Create a New Partition<\/span><\/h3>\n<p>Now, it is time to create a new partition through the parted command. Take a look below.\u00a0<\/p>\n<ul>\n<li><strong>Select Partition Type:<\/strong> Choose between primary or logical partitions. For this example, we will create a primary partition.<\/li>\n<\/ul>\n<pre><code>Mkpart<\/code><\/pre>\n<figure><\/figure>\n<ul>\n<li><strong>Specify Partition Type and File System:<\/strong> Enter the type of partition (primary, extended, etc.) and the file system type if prompted.<\/li>\n<\/ul>\n<pre><code>mkpart primary ext2 1MiB 20GiB<\/code><\/pre>\n<figure><\/figure>\n<p>This creates a primary partition formatted with ext4, starting at 1 MiB and ending at 20 GiB.<\/p>\n<h3><span id=\"Step_5_Verify_and_Apply_Changes\">Step 5: Verify and Apply Changes<\/span><\/h3>\n<p>Once everything is done, you need to ensure there are no hiccups. Check the new partition setup to ensure it meets your requirements.<\/p>\n<pre><code>print<\/code><\/pre>\n<p>If everything looks good, the changes are automatically saved. You don\u2019t need to use a separate command like w in fdisk to write changes, as parted applies changes immediately.<\/p>\n<h2><span id=\"Format_Partition\">Format Partition<\/span><\/h2>\n<p>Now that you have <strong>created a partition in Linux<\/strong>, your next action should be to perform the format. Why is it important? The format approach ensures the proper deployment of a file system on the disk. This helps organize the data. To do so, you will have to use the \u201cmkfs\u201d command.\u00a0<\/p>\n<h3><span id=\"Step_1_List_Existing_Partitions\">Step 1: List Existing Partitions<\/span><\/h3>\n<p>The format process, too, requires the user to list the existing partitions. This will help identify the right disk to format. Use the below command to do so.<\/p>\n<pre><code>sudo fdisk -l<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Step_2_Choose_the_Correct_Partition\">Step 2: Choose the Correct Partition<\/span><\/h3>\n<p>Identify the partition from the list you wish to format. For this example, let\u2019s assume the partition you want to format is \/dev\/sdb1.<\/p>\n<h3><span id=\"Step_3_Format_the_Partition\">Step 3: Format the Partition<\/span><\/h3>\n<p>Use the mkfs (make file system) command to format the partition. You can choose different file system types depending on your needs. Some common examples of file system types are ext4, xfs, ntfs, etc.\u00a0<\/p>\n<ul>\n<li><strong>For ext4 File System:<\/strong> <strong>Command:<\/strong><\/li>\n<\/ul>\n<pre><code>sudo mkfs.ext4 \/dev\/sdb1<\/code><\/pre>\n<figure><\/figure>\n<ul>\n<li><strong>For xfs File System:<\/strong> <strong>Command:<\/strong><\/li>\n<\/ul>\n<pre><code>sudo mkfs.xfs \/dev\/sdb1<\/code><\/pre>\n<figure><\/figure>\n<ul>\n<li><strong>For ntfs File System:<\/strong> <strong>Command:<\/strong><\/li>\n<\/ul>\n<pre><code>sudo mkfs.ntfs \/dev\/sdb1<\/code><\/pre>\n<h3><span id=\"Step_4_Verify_the_Formatting\">Step 4: Verify the Formatting<\/span><\/h3>\n<p>Once the formatting steps are done, you need to ensure that the process goes smoothly. Enter any of the below commands to do so.<\/p>\n<pre><code>sudo blkid\u00a0<\/code><\/pre>\n<figure><\/figure>\n<p>or<\/p>\n<pre><code>lsblk -f<\/code><\/pre>\n<figure><\/figure>\n<p>The above steps will complete the format process for the user in a simplified manner.\u00a0<\/p>\n<p>Also Read: How to Format a Disk in Linux\/Ubuntu OS?<\/p>\n<h2><span id=\"Mount_Partition\">Mount Partition<\/span><\/h2>\n<p>Now, we have created a new partition and saved the changes, but next, what? Can we use it? Well, there is one last important thing that needs to be done. You need to mount the partition, which attaches the partition to the directory. This will help you to read and write the separation without any issues. Here\u2019s a step-by-step guide to mounting a partition in Linux:<\/p>\n<h3><span id=\"Step_1_List_Existing_Partitions1\">Step 1: List Existing Partitions<\/span><\/h3>\n<p>Before mounting, list the existing partitions to identify the one you want to mount.<\/p>\n<pre><code>sudo fdisk -l<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Step_2_Create_a_Mount_Point\">Step 2: Create a Mount Point<\/span><\/h3>\n<p>A mount point is a directory where the partition will be attached to the file system. You need to create this directory.<\/p>\n<pre><code>sudo mkdir \/mnt\/my_partition<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Step_3_Mount_the_Partition\">Step 3: Mount the Partition<\/span><\/h3>\n<p>Use the mount command to attach the partition to the mount point.<\/p>\n<pre><code>sudo mount \/dev\/sdb1 \/mnt\/my_partition<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Step_4_Verify_the_Mount\">Step 4: Verify the Mount<\/span><\/h3>\n<p>Check that the partition is mounted correctly and is accessible.<\/p>\n<pre><code>df -h<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Step_5_Access_the_Partition\">Step 5: Access the Partition<\/span><\/h3>\n<p>Navigate to the mount point to access the files on the partition.<\/p>\n<pre><code>cd \/mnt\/my_partition<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Step_6_Unmount_the_Partition\">Step 6: Unmount the Partition\u00a0<\/span><\/h3>\n<p>When you\u2019re done using the partition, you can unmount it. This is necessary before disconnecting the disk or making changes.<\/p>\n<pre><code>sudo umount \/mnt\/my_partition<\/code><\/pre>\n<figure><\/figure>\n<h2><span id=\"Conclusion\">Conclusion<\/span><\/h2>\n<p>Linux is an amazing operating system that works with clear partitions. In this article, we discussed the importance and concept of<strong> partition creation in Linux<\/strong>. We shed light on how a disk is partitioned and how it leads to proper data organization. Here, we talked about how these partitions are managed. Our informative piece perfectly elaborated on the implementation of important commands like \u201cfdisk\u201d and \u201cparted\u201d in order to create a new partition. We shared the process of partition formatting and mounting in detail. Remember that each step is important to make sure your data is organized. So, next time you need to set up a new disk or reorganize an old one, remember these steps to get it done right!<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Management is an essential component of control and productivity. In the world of computers, the control factor depends on the operating system. An operating system allows the user to take control of the computer, and Linux is an excellent example of this OS. It helps complete various computing tasks by managing the hardware and<\/p>\n","protected":false},"author":3,"featured_media":3076,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[17],"tags":[],"class_list":["post-3229","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dedicated-servers"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/posts\/3229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/comments?post=3229"}],"version-history":[{"count":0,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/posts\/3229\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/media\/3076"}],"wp:attachment":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/media?parent=3229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/categories?post=3229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/tags?post=3229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}