- How to Create a Disk Partitions in Linux
- Creating a Disk Partition in Linux
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- Top 6 Partition Managers (CLI + GUI) for Linux
- 1. Fdisk
- 2. GNU Parted
- 3. Gparted
- 4. GNOME Disks a.k.a ( GNOME Disks Utility)
- 5. KDE Partition Manager
- 6. Qtparted
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- 10 fdisk Commands to Manage Linux Disk Partitions
- 1. View all Disk Partitions in Linux
- 2. View Specific Disk Partition in Linux
- 3. Check all Available fdisk Commands
- 4. Print all Partition Table in Linux
- 5. How to Delete a Partition in Linux
- 6. How to Create a New Partition in Linux
- 7. How to Format a Partition in Linux
- 8. How to Check Size of a Partition in Linux
- 9. How to Fix Partition Table Order
- 10. How to Disable Boot Flag (*) of a Partition
- If You Appreciate What We Do Here On TecMint, You Should Consider:
How to Create a Disk Partitions in Linux
In order to effectively use storage devices such as hard drives and USB drives on your computer, you need to understand and know how to structure them before using in Linux. In most cases, big storage devices are split into separate portions called partitions.
Partitioning enables you to split your hard drive into multiple parts, where each part acts as its own hard drive and this is useful when you are installing multiple operating systems in the same machine.
In this article, we will explain how to partition a storage disk in Linux systems such as CentOS, RHEL, Fedora, Debian and Ubuntu distributions.
Creating a Disk Partition in Linux
In this section, we will explain how to partition a storage disk in Linux using the parted command.
The first step is to view the partition table or layout on all block devices. This helps you identify the storage device you want to partition. You can do this using parted or fdisk command. We will use the former for purposes of demonstration, as follows, where the -l flag means list partition layout on all block devices.
List Partitions in Linux
From the output of the above command, there are two hard disks attached to the test system, the first is /dev/sda and the second is /dev/sdb .
In this case, we want to partition hard disk /dev/sdb . To manipulate disk partitions, open the hard disk to start working on it, as shown.
At the parted prompt, make a partition table by running mklabel msdos or gpt, then enter Y/es to accept it.
Make Disk Label
Important: Make sure to specify the correct device for partition in the command. If you run parted command without a partition device name, it will randomly pick a storage device to modify.
Next, create a new primary partition on the hard disk and print the partition table as shown.
Create Partition in Linux
You can create another partition for the reaming space as shown.
Create Another Partition
To quit, issue the quit command and all changes are automatically saved.
Next, create the file system type on each partition, you can use the mkfs utility (replace ext4 with the file system type you wish to use).
Create Filesystem Type on Partition
Last but not least, to access the storage space on the partitions, you need to mount them by creating the mount points and mount the partitions as follows.
To check if the partitions are actually mounted, run the df command to report file system disk space usage.
Check Partitions Disk Space Usage
Important: You may need to update /etc/fstab file to mount newly created partitions automatically at boot time.
You might also like to read these following related articles:
That’s all! In this article, we have shown how to partition a storage disk, create a file system type on a partition and mount it in Linux systems. You can ask questions or share you thoughts with us via the comment form below.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Источник
Top 6 Partition Managers (CLI + GUI) for Linux
Are you looking to tweak or manage your disks partitions in Linux? In this article, we will review some of the best tools that help Linux users partition and manage their disks. We will see both command line utilities as well as GUI applications for managing disk partitions in Linux.
I favor the command line over GUI (graphical user interface), I will start by describing the text based utilities and then GUI applications as follows.
1. Fdisk
fdisk is a powerful and popular command line tool used for creating and manipulating disk partition tables. It supports multiple partition tables formats, including MS-DOS and GPT. It provides a user-friendly, text based and menu driven interface to display, create, resize, delete, modify, copy and move partitions on disks.
Fdisk Partition Tool
2. GNU Parted
Parted is a popular command line tool for managing hard disk partitions. It supports multiple partition table formats, including MS-DOS, GPT, BSD and many more. With it, you can add, delete, shrink and extend disk partitions along with the file systems located on them.
Parted Partition Program
It can help you create space for installing new operating systems, reorganizing disk usage, and move data to new hard disks.
3. Gparted
GParted is a free, cross platform and advanced graphical disk partition manager that works on Linux operating systems, Mac OS X and Windows.
GParted Partition Manager and Editor
It is used to resize, copy, move, label, check or delete partitions without data loss, enabling you to grow or shrink root partition, create space for new operating systems and attempt data rescue from lost partitions. It can be used to manipulate file systems including EXT2/3/4.
4. GNOME Disks a.k.a ( GNOME Disks Utility)
GNOME Disks is a core system utility used for disk partition management and S.M.A.R.T monitoring. It is used to format and create partition on drives, mount and unmount partitions. It ships in with the well known GNOME desktop environment.
Gnome Disks
Lately, it’s been gaining features for advanced usage. The latest version (at the time of this writing) has a new feature for adding, resizing partitions, checking filesystems for any damages and repairing them.
5. KDE Partition Manager
KDE partition manager is a useful graphical utility for managing disk devices, partitions and file systems on your computer. It comes with the KDE desktop environment.
KDE Partition Manager
Most of its underlying work is performed by programs. It can be used to easily create, copy, move, delete, resize without losing data, backup and restore partitions. It supports various including EXT2/3/4, BTRFS NTFS, FAT16/32, XFS, and more.
6. Qtparted
In addition, you can also use Qtparted, is a Partition Magic (proprietary software for Windows) clone and Qt front-end to GNU Parted. Note that it still in development and you may likely experience any kind of problem with latest release. In that case try to use the CVS version or a previous stable version.
QTParted Partition Magic
It may not be one of the best options now but you can give it a try. More features are yet being added to it.
You might also like to read these following related articles.
These are the best partition managers and editors available for Linux operating systems. Which tool do you use? Let us know via the comment section below. Also let us know of any other partition managers for Linux, missing in the list above.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Источник
10 fdisk Commands to Manage Linux Disk Partitions
fdisk stands (for “fixed disk or format disk“) is an most commonly used command-line based disk manipulation utility for a Linux/Unix systems. With the help of fdisk command you can view, create, resize, delete, change, copy and move partitions on a hard drive using its own user friendly text based menu driven interface.
This tool is very useful in terms of creating space for new partitions, organising space for new drives, re-organising an old drives and copying or moving data to new disks. It allows you to create a maximum of four new primary partition and number of logical (extended) partitions, based on size of the hard disk you have in your system.
fdisk command to manage disk partition
This article explains 10 basic fdisk commands to manage a partition table in Linux based systems. You must be root user to run fdisk command, otherwise you will get a “command not found” error.
1. View all Disk Partitions in Linux
The following basic command list all existing disk partition on your system. The ‘-l‘ argument stand for (listing all partitions) is used with fdisk command to view all available partitions on Linux. The partitions are displayed by their device’s names. For example: /dev/sda, /dev/sdb or /dev/sdc.
2. View Specific Disk Partition in Linux
To view all partitions of specific hard disk use the option ‘-l‘ with device name. For example, the following command will display all disk partitions of device /dev/sda. If you’ve different device names, simple write device name as /dev/sdb or /dev/sdc.
3. Check all Available fdisk Commands
If you would like to view all commands which are available for fdisk. Simply use the following command by mentioning the hard disk name such as /dev/sda as shown below. The following command will give you output similar to below.
Type ‘m‘ to see the list of all available commands of fdisk which can be operated on /dev/sda hard disk. After, I enter ‘m‘ on the screen, you will see the all available options for fdisk that you can be used on the /dev/sda device.
4. Print all Partition Table in Linux
To print all partition table of hard disk, you must be on command mode of specific hard disk say /dev/sda.
From the command mode, enter ‘p‘ instead of ‘m‘ as we did earlier. As I enter ‘p‘, it will print the specific /dev/sda partition table.
5. How to Delete a Partition in Linux
If you would like to delete a specific partition (i.e /dev/sda9) from the specific hard disk such as /dev/sda. You must be in fdisk command mode to do this.
Next, enter ‘d‘ to delete any given partition name from the system. As I enter ‘d‘, it will prompt me to enter partition number that I want to delete from /dev/sda hard disk. Suppose I enter number ‘4‘ here, then it will delete partition number ‘4‘ (i.e. /dev/sda4) disk and shows free space in partition table. Enter ‘w‘ to write table to disk and exit after making new alterations to partition table. The new changes would only take place after next reboot of system. This can be easily understood from the below output.
Warning : Be careful, while performing this step, because using option ‘d‘ will completely delete partition from system and may lost all data in partition.
6. How to Create a New Partition in Linux
If you’ve free space left on one of your device say /dev/sda and would like to create a new partition under it. Then you must be in fdisk command mode of /dev/sda. Type the following command to enter into command mode of specific hard disk.
After entering in command mode, now press “n” command to create a new partition under /dev/sda with specific size. This can be demonstrated with the help of following given output.
While creating a new partition, it will ask you two options ‘extended‘ or ‘primary‘ partition creation. Press ‘e‘ for extended partition and ‘p‘ for primary partition. Then it will ask you to enter following two inputs.
- First cylinder number of the partition to be create.
- Last cylinder number of the partition to be created (Last cylinder, +cylinders or +size).
You can enter the size of cylinder by adding “+5000M” in last cylinder. Here, ‘+‘ means addition and 5000M means size of new partition (i.e 5000MB). Please keep in mind that after creating a new partition, you should run ‘w‘ command to alter and save new changes to partition table and finally reboot your system to verify newly created partition.
7. How to Format a Partition in Linux
After the new partition is created, don’t skip to format the newly created partition using ‘mkfs‘ command. Type the following command in the terminal to format a partition. Here /dev/sda4 is my newly created partition.
8. How to Check Size of a Partition in Linux
After formatting new partition, check the size of that partition using flag ‘s‘ (displays size in blocks) with fdisk command. This way you can check size of any specific device.
9. How to Fix Partition Table Order
If you’ve deleted a logical partition and again recreated it, you might notice ‘partition out of order‘ problem or error message like ‘Partition table entries are not in disk order‘.
For example, when three logical partitions such as (sda4, sda5 and sda6) are deleted, and new partition created, you might expect the new partition name would be sda4. But, the system would create it as sda5. This happens because of, after the partition are deleted, sda7 partition had been moved as sda4 and free space shift to the end.
To fix such partition order problems, and assign sda4 to the newly created partition, issue the ‘x‘ to enter an extra functionality section and then enter ‘f‘ expert command to fix the order of partition table as shown below.
After, running ‘f‘ command, don’t forget to run ‘w‘ command to save and exit from fdisk command mode. Once it fixed partition table order, you will no longer get error messages.
10. How to Disable Boot Flag (*) of a Partition
By default, fdisk command shows the boot flag (i.e. ‘*‘) symbol on each partition. If you want to enable or disable boot flag on a specific partition, do the following steps.
Press ‘p‘ command to view the current partition table, you see there is a boot flag (asterisk (*) symbol in orange color) on /dev/sda1 disk as shown below.
Next enter command ‘a‘ to disable boot flag, then enter partition number ‘1‘ as (i.e. /dev/sda1) in my case. This will disable boot flag on the partition /dev/sda1. This will remove the asterisk (*) flag.
I’ve tried my best to include almost all basic commands of fdisk commands, but still fdisk contains a variety of other expert commands you can use them by entering ‘x‘. For more detailed information, check out ‘man fdisk‘ command from the terminal. If I’ve missed any important command, please do share with me via comment section.
Read Also :
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Источник