How To Format A Disk In Linux

Table of contents:

How To Format A Disk In Linux
How To Format A Disk In Linux

Video: How To Format A Disk In Linux

Video: How To Format A Disk In Linux
Video: How to Partition and Format a Disk in Linux 2024, May
Anonim

Formatting hard drives in Windows is usually straightforward. Such an operation in a Linux environment can cause problems for an untrained user.

How to format a disk in Linux
How to format a disk in Linux

Necessary

  • Ubuntu operating system
  • Gparted utility or internet access to install it

Instructions

Step 1

The Linux operating system requires three partitions. This is the root partition, the swap partition, and the partition for user data. The root section contains the operating system files. Its size must be at least 5 gigabytes. This is the only section that you must create. The swap partition is intended to accommodate the virtual RAM of the computer. Its creation is optional, if the partition is not created, the operating system will automatically create and use the paging file in the root partition. Using a dedicated swap partition is more efficient because it is not fragmented. Its size should be equal to the size of the computer's RAM. The rest of the hard disk space is usually allocated for the section with the user's files.

Step 2

Check which partitions are already in the system. Open an administrator console and enter the command "fdisk / dev / hda" for IDE hard drives, or "fdisk / dev / sda" for SATA hard drives. If the system has more than one hard drive, the first one will be called hda, the second hdb, and so on. The principle is the same for SATA drives. As a result, the application for partitioning and formatting the hard disk will start.

Step 3

Enter the "p" command. The current hard disk partition table will be displayed. Use the "d" command to remove existing partitions. The system will ask for the number of the partition on the disk to be deleted. Remove the partitions if necessary, and then enter the "p" command to check. If the wrong section is deleted by mistake, the "q" command will roll back the changes.

Step 4

Create a new partition in the free space. To do this, you can also use the fdisk utility built into the operating system, but it does not have a graphical interface, does not support large partitions, and also has a number of other disadvantages. Therefore, it is better to use the gparted utility to create a partition, which has a graphical interface. Open the admin console and enter the "gparted" command. If such a program is not present on the system, install it with the command "apt-get gparted". A graphical window will open showing the current hard disk partition table.

Step 5

Select the unallocated area, right-click on it. In the drop-down menu, select "create a partition", specify its size, file system and mount point. Click OK. Now you need to apply the changes you made. To do this, click on the button and the green checkmark. Click OK. Wait until the program finishes. The new section is now ready to use.

Recommended: