lkpdir.blogg.se

How to format my hard drive on linux
How to format my hard drive on linux










how to format my hard drive on linux

You can break down this command as follows: sudo parted -a opt /dev/sda mkpart primary ext4 0% 100%.Once the format is selected, you can create a partition spanning the entire drive by using parted -a: To use the MBR format, use mklabel msdos: To choose the GPT standard, pass the disk you identified to parted with mklabel gpt: For a typical cloud server, GPT is a better option. GPT is a more modern standard, while MBR is more widely supported among older operating systems. To do this, you first need to specify the partitioning standard to use. Step 3 - Partition the New DriveĪs mentioned in the introduction, you’ll create a single partition spanning the entire disk in this guide. When you know the name that the kernel has assigned your disk, you can partition your drive. See our introduction to storage concepts and terminology in Linux article for more information. The /dev/sd* and /dev/hd* disk identifiers will not necessarily be consistent between boots, which means there is some danger of partitioning or formatting the wrong disk if you do not verify the disk identifier correctly.Ĭonsider using more persistent disk identifiers like /dev/disk/by-uuid, /dev/disk/by-label, or /dev/disk/by-id. Note: Remember to check lsblk every time you reconnect to your server before making changes. You should see an unrecognized disk label error for the new, unpartitioned disk: This can be used to help identify the new disk: If you ask parted to list the partition layout of your disks, it will produce an error for any disks that don’t have a valid partition scheme. If this is a completely new drive, One way to identify it on your server is to look for the absence of a partitioning scheme. Step 2 - Identify the New Disk on the Systemīefore you set up the drive, you need to be able to properly identify it on the server.

#How to format my hard drive on linux install#

If you are on an RHEL, Rocky Linux, or Fedora server, you can install it by typing:Įvery other command used in this tutorial should be preinstalled, so you can move on to the next step. If you are on an Ubuntu or Debian server and do not have parted installed, you can install it by typing: parted, which creates partitions, is one of the only occasional exceptions. Most of the commands necessary for interacting with a low-level filesystem are available by default on Linux. To partition the drive, you’ll use the parted utility. Mounting and setting up Auto-mounting of the filesystem at boot.Formatting the partition with the Ext4 filesystem (the default in most modern Linux distributions).Creating a single partition that spans the entire drive (most operating systems expect a partition layout, even if only one filesystem is present).Identifying the new disk on the system.This guide will cover the following process: There are many tools, filesystem formats, and partitioning schemes that may change the process if you have specialized needs, but the fundamentals remain the same. Preparing a new disk for use on a Linux system is a straightforward process.












How to format my hard drive on linux