Creating a New File System (2023)

Creating a New File System

These steps cover how to create a new file systemon a Linux system which is using disks directly rather than some kind of storage virtualization. Though the Logical Volume Manager may be used to handle several of these steps, a good understanding of them helps in comprehending what the storage virtualization software is doing for you.

WARNING: There are several steps in creating a new file system where you could unexpectedly erase a disk! It is a good idea to back up critical data and configuration files before attempting to create a file system.

The basic steps for creating a new file system are as follows. These steps must be performed by the root user.

  1. Add disk to the system if free space is not available on the current disks.
  2. Identify and partition the space to be used.
  3. Build the file system.
  4. Mount the file system for use.
  5. Consult your hardware documentation if you need to add a disk to your system. Each system is different and any details on adding disks should be included in the documentation.

New disks appear in the /dev directory after startup. They typically have a name starting with hd or sd followed by another letter, but disks may appear under different names depending on the hardware configuration. In the following example, the disk I added appears as /dev/hdd.

Identifying and Partioning Space to be Used

Whether adding a new disk or using space on an existing disk, a partition now needs to be created on the disk to identify what space on the disk should be used. A disk can be partitioned into a single partition or several partitions can be made on that disk. GNU parted can be used to create the necessary partitions, but some users prefer to use fdisk. While fdisk offers some advanced options that parted does not, parted is easier to use and sufficient for most purposes.

WARNING: Any of these steps may result in lost data if performed on a disk with existing partitions. A backup of essential data and configuration files should be taken before proceeding.

The parted utilityexpects an argument to be provided to identify the device to be partitioned. In this case, I started parted to modify /dev/hdd:

# parted /dev/hdd

GNU Parted 1.8.1
Using /dev/hdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
At any time, enter help at the parted prompt for a list of commands with short descriptions. Now you can use the print command to show the current partition table, also referred to as a disk label, before you make any modifications to it.

(parted) print

Error: Unable to open /dev/hdd - unrecognized disk label.

Since this is a new disk, there is no partition table to read, so an error appears. To create a label on this device, use the mklabel command. There are several label types available, but for most purposes, msdos is more appropriate.

(parted) mklabel msdos
(parted) print

Model: VBOX HARDDISK (ide)
Disk /dev/hdd: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags

The newly created partition table can now be printed without error. The column headers are shown here, but since no partitions have been created, no rows are shown. One thing that can be done at this point is show unused space by typing print free at the parted prompt.

(parted) print free

Model: VBOX HARDDISK (ide)
Disk /dev/hdd: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
0.00kB 10.7GB 10.7GB Free Space

The free space is shown under the Size column. The free space should be close to the
size of the disk added, but is rarely exactly the same. The Start and End columns represent where that contiguous space begins and ends on the disk.

When you create partitions, you are prompted to enter start and end values in megabytes, but the default output of the print command adjusts to use gigabytes and terabytes on large disks. You can change the display units to megabytes to make the print output consistent with what you need to enter.

(parted) unit mb
(parted) print

Model: VBOX HARDDISK (ide)
Disk /dev/hdd: 10737MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
0.00MB 10737MB 10737MB Free Space
Now that an idea of how much space is available on the disk has been illustrated, create a new partition using the mkpart command. After entering the mkpart command, you are prompted to enter some information about the kind and size of the partition you want to create.

(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]? ext3
Start? 0
End? 5000

These values can also be entered as arguments to the mkpart command. The following command would do exactly the same as above.

(parted) mkpart primary ext3 0 5000

The first question is if this partition should be primary or extended. Only four primary partitions can be created on each disk. A larger number of extended partitions can be created, but one primary partition number is used to create the additional extended partitions.

Next, you are prompted to enter the file system type. Typically, you will want to use ext3unless you have some specific reason to use another file system type. Finally, the start and end values are entered to indicate where on the disk the new partition should start and end. These values are entered in megabytes. The partition cannot overlap any other partitions.

The print commandcan now be used to show the partition table contents. The free option is used to also show free space available.

(parted) print free
Model: VBOX HARDDISK (ide)
Disk /dev/hdd: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 0.03MB 5001MB 5001MB primary
5001MB 10734MB 5733MB Free Space

When adding additional partitions, care needs to be taken not to overlap existing ones. Taking the example you have so far, you would not want to start a new partition lower than 5001. parted is smart enough, however, to give a warning if you request space already allocated to a different partition.

The start and end locations need to be entered for the new partition. If a partition to use the remaining space needs to be created, give the same start and end values currently listed as free space.

(parted) mkpart primary ext3 5001 10734
(parted) print

Model: VBOX HARDDISK (ide)
Disk /dev/hdd: 10737MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 0.03MB 5001MB 5001MB primary
2 5001MB 10734MB 5733MB primary

(parted) quit

Information: Don't forget to update /etc/fstab, if necessary.

Now that you have used up all free space on this disk, you no longer see an entry for free space. Changes made in parted are automatically written to the partition table, so you can simply type exit when you are done. parted prints a reminder to update the /etc/fstab file if necessary but before you do that, you need to build the file system on the partition.

After the partitions are created, they automatically show up in /dev with the drive name (hdd in this case) appended with the partition number.

# ls /dev/hdd*

/dev/hdd /dev/hdd1 /dev/hdd2

These device nameswill be used in the upcoming steps to create the file systems and mount them for use.

Creating a New File System (1)

Get the Complete Details on
Linux System Management for Oracle DBAs

The landmark book "Linux for the Oracle DBA: The Definitive Reference"provides comprehensive yet specific knowledge on administering Oracle on Linux. A must-have reference for every DBA running or planning to run Oracle on a Linux platform.

Buy it for 30% off directly from the publisher.

Creating a New File System (2)

Burleson is the American Team

Creating a New File System (3)

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals. Feel free to ask questions on ourOracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata? Oracle technology is changing and we strive to update our BC Oracle support information. If you find an error or have a suggestion for improving our content, we would appreciate your feedback. Just e-mail:

Creating a New File System (4)and include the URL for the page.

Creating a New File System (5)Creating a New File System (6)

Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services

Copyright © 1996 - 2020

All rights reserved by Burleson


® is the registered trademark of Oracle Corporation.


How do I create a new file system? ›

To create a filesystem, there are three steps:
  1. Create partitions using fdisk or Disk Utility. ...
  2. Format the partitions using mkfs or Disk Utility.
  3. Mount the partitions using the mount command or automate it using the /etc/fstab file.
Jan 24, 2022

What is creating file system? ›

A file system consists of a number of disks that hold both file system metadata and user data. A file system can have multiple storage pools and filesets that can simplify system and storage administration.

Which command creates a file system? ›

The mkfs command makes a new file system on a specified device. The mkfs command initializes the volume label, file system label, and startup block.

Why is the file system important? ›

The most important purpose of a file system is to manage user data. This includes storing, retrieving and updating data. Some file systems accept data for storage as a stream of bytes which are collected and stored in a manner efficient for the media.

How do I get into file system? ›

Windows file system access and privacy
  1. In Windows 10, go to Start > Settings > Privacy > File system.
  2. In Windows 11, go to Start > Settings > Privacy & security > File system.

What is simple file system? ›

Overview. At its most basic level a filesystem is simply one very large file that contains... other files. That's it.

What is the basic file system? ›

Basic file system – It Issues general commands to the device driver to read and write physical blocks on disk. It manages the memory buffers and caches. A block in the buffer can hold the contents of the disk block and the cache stores frequently used file system metadata.

What is a file system for dummies? ›

A file system is a method an operating system uses to store, organize, and manage files and directories on a storage device. Some common types of file systems include: FAT (File Allocation Table): An older file system used by older versions of Windows and other operating systems.

How to create a file with command? ›

Open your terminal window and run the following command:
  1. Command: $ file abc.
  2. Command: $ touch abc.txt.
  3. Command: $ cat > abcFile.txt.
  4. Command: $ > abcFile.txt.
  5. Command: $ echo "This is the File name file1"
  6. Command: $ echo "This is the File name file3" > file3.txt.
Feb 16, 2023

Which command is used to create a file give example? ›

The touch command is the simplest way to create a new file from the command line. We can create multiple files by executing this command at once. To create a file, execute the touch command followed by the file name as given below: touch test1.

What is the format command for file system? ›

After DiskPart successfully created the specified partition, type format fs=ntfs (or format fs=exfat) and press "Enter". It tells DiskPart to format the disk to a specific file system, let it be NTFS, exFAT, etc. Step 8. At last, assign a drive letter to the newly created partition by typing assign.

What are the 4 types of file system? ›

This page compares four types of common file system formats - NTFS, FAT32, exFAT, and EXT2/2/4, and helps you figure out which File system format to use on your storage devices.

How does file system work? ›

A file system is a set of data structures, interfaces, abstractions, and APIs that work together to manage any type of file on any type of storage device, in a consistent manner. Each operating system uses a particular file system to manage the files.

What are the 5 basic filing systems? ›

There are 5 methods of filing:
  • Filing by Subject/Category.
  • Filing in Alphabetical order.
  • Filing by Numbers/Numerical order.
  • Filing by Places/Geographical order.
  • Filing by Dates/Chronological order.

How do I change the file system on my computer? ›

PC Instructions
  1. Select the drive you wish to format from the list.
  2. Right click on the drive and select Format.
  3. Enter a name for the drive in Volume label and select the format type in the File system dropdown box.
  4. Click OK. It will take a short while to delete all the files and change the format of the disk.

How do I create a NTFS file system? ›

How to format a USB flash drive or external storage device to NTFS on Windows
  1. Plug the USB drive or external storage device into your Windows 10/11 PC.
  2. Open File Explorer.
  3. Right-click your USB drive or external storage device.
  4. From the pop-up menu, select Format.
  5. In the File system drop-down menu, select NTFS.

Top Articles
Latest Posts
Article information

Author: Melvina Ondricka

Last Updated: 06/12/2023

Views: 6198

Rating: 4.8 / 5 (68 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Melvina Ondricka

Birthday: 2000-12-23

Address: Suite 382 139 Shaniqua Locks, Paulaborough, UT 90498

Phone: +636383657021

Job: Dynamic Government Specialist

Hobby: Kite flying, Watching movies, Knitting, Model building, Reading, Wood carving, Paintball

Introduction: My name is Melvina Ondricka, I am a helpful, fancy, friendly, innocent, outstanding, courageous, thoughtful person who loves writing and wants to share my knowledge and understanding with you.