- ИТ База знаний
- Полезно
- Навигация
- Серверные решения
- Телефония
- Корпоративные сети
- Как отформатировать разделы диска в Linux
- Проверка разделов
- Форматирование раздела диска в Linux
- Форматирование раздела диска с файловой системой ext4
- Форматирование раздела диска с файловой системой FAT32
- Форматирование раздела диска с файловой системой NTFS
- Монтирование раздела диска в Linux
- Понимание файловой системы Linux
- How to Create a New Ext4 File System (Partition) in Linux
- Creating a New Partition in Linux
- Formatting New Ext4 Partition
- Mounting New Ext4 Parition in File System
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- How to Format Disk Partitions in Linux
- Checking the Partitions
- Formatting Disk Partition in Linux
- Formatting Disk Partition with ext4 File System
- Formatting Disk Partition with FAT32 File System
- Formatting Disk Partition with NTFS File System
- Mounting the Disk Partition in Linux
- Understanding the Linux File System
ИТ База знаний
Курс по Asterisk
Полезно
— Узнать IP — адрес компьютера в интернете
— Онлайн генератор устойчивых паролей
— Онлайн калькулятор подсетей
— Калькулятор инсталляции IP — АТС Asterisk
— Руководство администратора FreePBX на русском языке
— Руководство администратора Cisco UCM/CME на русском языке
— Руководство администратора по Linux/Unix
Навигация
Серверные решения
Телефония
FreePBX и Asterisk
Настройка программных телефонов
Корпоративные сети
Протоколы и стандарты
Как отформатировать разделы диска в Linux
4 минуты чтения
Перед использованием раздел диска необходимо отформатировать и смонтировать. Процесс форматирования также может быть выполнен по ряду других причин, таких как изменение файловой системы, исправление ошибок или удаление всех данных.
Мини — курс по виртуализации
Знакомство с VMware vSphere 7 и технологией виртуализации в авторском мини — курсе от Михаила Якобсена
В этом руководстве вы узнаете, как форматировать и монтировать разделы диска в Linux с использованием файловой системы ext4, FAT32 или NTFS.
Проверка разделов
Перед форматированием найдите раздел, который хотите отформатировать. Для этого запустите команду lsblk , которая отображает блочные устройства. Блочные устройства — это файлы, которые представляют такие устройства, как жесткие диски, RAM-диски, USB-накопители и CD/ROM.
Терминал покажет список всех блочных устройств, а также информацию о них:
- NAME — имена устройств
- MAJ:MIN — старший или младший номер устройства
- RM — является ли устройство съемным (1, если да, 0, если нет)
- SIZE — размер устройства
- RO — доступно ли устройство только для чтения
- TYPE — тип устройства
- MOUNTPOINT — точка монтирования устройства
В качестве примера мы будем использовать раздел /dev/sdb1 .
Команда lsblk без дополнительных параметров не отображает информацию о файловых системах устройств.
Чтобы отобразить список, содержащий информацию о файловой системе, добавьте параметр -f :
Терминал покажет список всех блочных устройств. Разделы, не содержащие информации об используемой файловой системе, являются неформатированными разделами.
Форматирование раздела диска в Linux
В зависимости от типа файловой системы существует три способа форматирования разделов диска с помощью команды mkfs :
Общий синтаксис форматирования разделов диска в Linux:
Форматирование раздела диска с файловой системой ext4
1. Отформатируйте раздел диска с файловой системой ext4, используя следующую команду:
2. Затем проверьте изменение файловой системы с помощью команды:
Терминал покажет список блочных устройств.
3. Найдите нужный раздел и убедитесь, что он использует файловую систему ext4.
Форматирование раздела диска с файловой системой FAT32
1. Чтобы отформатировать диск в файловой системе FAT32, используйте:
2. Снова запустите команду lsblk , чтобы проверить изменение файловой системы и найти нужный раздел в списке.
Форматирование раздела диска с файловой системой NTFS
1. Запустите команду mkfs и укажите файловую систему NTFS для форматирования диска:
Терминал покажет подтверждающее сообщение, когда процесс форматирования завершится.
2. Затем проверьте изменение файловой системы, используя:
3. Найдите нужный раздел и убедитесь, что он использует файловую систему NFTS.
Монтирование раздела диска в Linux
Перед использованием диска создайте точку монтирования и смонтируйте к ней раздел. Точка монтирования — это каталог, используемый для доступа к данным, хранящимся на дисках.
1. Создайте точку монтирования, введя:
2. После этого смонтируйте раздел с помощью следующей команды:
Примечание. Замените [mountpoint] предпочтительной точкой монтирования (пример: /usr/media ).
Если процесс завершился успешно, вывода нет.
3. Убедитесь, что раздел смонтирован, используя следующую команду:
Понимание файловой системы Linux
Выбор правильной файловой системы перед форматированием диска для хранения имеет решающее значение. Каждый тип файловой системы имеет разные ограничения размера файла или разную совместимость с операционной системой.
Наиболее часто используемые файловые системы: FAT32, NTFS и ext4
Их основные особенности и отличия:
Файловая система | Поддерживаемый размер файла | Совместимость | Идеальное использование |
FAT32 | до 4 ГБ | Windows, Mac, Linux | Для максимальной совместимости |
NTFS | 16 EiB — 1 КB | Windows, Mac (только для чтения), большинство дистрибутивов Linux | Для внутренних дисков и системного файла Windows |
Ext4 | 16 GiB — 16 TiB | Windows, Mac, Linux (для доступа требуются дополнительные драйверы) | Для файлов размером более 4 ГБ |
Онлайн курс по Linux
Мы собрали концентрат самых востребованных знаний, которые позволят тебе начать карьеру администратора Linux, расширить текущие знания и сделать уверенный шаг к DevOps
Источник
How to Create a New Ext4 File System (Partition) in Linux
The ext4 or fourth extended filesystem is a widely-used journaling file system for Linux. It was designed as a progressive revision of the ext3 file system and overcomes a number of limitations in ext3.
It has significant advantages over its predecessor such as improved design, better performance, reliability, and new features. Although it is best suited for hard drives, it can also be used on removable devices.
This article will show you how to create a new ext4 file system (partition) in Linux. We will first of all look at how to create a new partition in Linux, format it with the ext4 file system and mount it.
Note: For the purpose of this article:
- We will assume that you have added a new hard drive to your Linux machine, in which you will create the new ext4 partition, and
- If you are operating the system as an administrative user, use the sudo command to gain root privileges to run the commands shown in this article.
Creating a New Partition in Linux
List the partitions using the fdisk -l or parted -l commands to identify the hard drive you want to partition.
List Linux Partitions
Looking at the output in the screenshot above, we have two hard disks added on the test system and we will partition disk /dev/sdb .
Now use parted command to start creating the partition on the selected storage device.
Then create a partition using the mkpart command, give it additional parameters like “primary” or “logical” depending on the partition type that you wish to create. Then select ext4 as the file system type, set the start and end to establish the size of the partition:
Create a New Ext4 Partition
To print the partition table on the device /dev/sdb or detailed information about the new partition, run the print command.
Print Partition Table
Now exit the program using the quit command.
Formatting New Ext4 Partition
Next, you need to properly format the new partition with the ext4 file system type using the mkfs.ext4 or mke4fs command as follows.
Format a New Ext4 Partition
Then label the partition using the e4label command as follows.
Mounting New Ext4 Parition in File System
Next, create a mount point and mount the newly created ext4 partition file system.
Now using the df command, you can list all file systems on your system together with their sizes in a human readable format (-h) , and their mount points and file system types (-T) :
Show Linux Filesystem with Mount Points
Lastly, add the following entry in your /etc/fstab to enable persistent mounting of the file system, even after a reboot.
You might also like to read these following related articles:
That’s all! In this article, we’ve explained how to create a new partition in Linux, format it with ext4 file system type and mount it as a filesystem. For more information or to share any queries with us, use the feedback 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.
Источник
How to Format Disk Partitions in Linux
Home » Bare Metal Servers » How to Format Disk Partitions in Linux
A disk partition must be formatted and mounted before use. The formatting process can also be done for several other reasons, such as changing the file system, fixing errors, or deleting all data.
In this tutorial, you will learn how to format and mount disk partitions in Linux using ext4, FAT32, or NTFS file system.
- A system running Linux
- A user account with sudo or root privileges
- Access to a terminal window / command line (Activities >Search >Terminal)
Checking the Partitions
Before formatting, locate a partition you wish to format. To do so, run the lsblk command that displays block devices. Block devices are files that represent devices such as hard drives, RAM disks, USB drives, and CD/ROM drives.
The terminal prints out a list of all block devices as well as information about them:
- NAME – Device names
- MAJ:MIN – Major or minor device numbers
- RM – Whether the device is removable (1 if yes, 0 if no)
- SIZE – The size of the device
- RO – Whether the device is read-only
- TYPE – The type of the device
- MOUNTPOINT – Device’s mount point
We will use the /dev/sdb1 partition as an example.
The lsblk command without additional options does not display information about the devices’ file systems.
To display a list containing file system information, add the -f option:
The terminal prints out the list of all block devices. The partitions that do not contain information on the file system in use are non-formatted partitions.
Note: Consider learning how to create partitions in Linux.
Formatting Disk Partition in Linux
There are three ways to format disk partitions using the mkfs command, depending on the file system type:
The general syntax for formatting disk partitions in Linux is:
Formatting Disk Partition with ext4 File System
1. Format a disk partition with the ext4 file system using the following command:
2. Next, verify the file system change using the command:
The terminal prints out a list of block devices.
3. Locate the preferred partition and confirm that it uses the ext4 file system.
Formatting Disk Partition with FAT32 File System
1. To format a disk with a FAT32 file system, use:
2. Again, run the lsblk command to verify the file system change and locate the preferred partition from the list.
The expected output is:
Formatting Disk Partition with NTFS File System
1. Run the mkfs command and specify the NTFS file system to format a disk:
The terminal prints a confirmation message when the formatting process completes.
2. Next, verify the file system change using:
3. Locate the preferred partition and confirm that it uses the NFTS file system.
Mounting the Disk Partition in Linux
Before using the disk, create a mount point and mount the partition to it. A mount point is a directory used to access data stored in disks.
1. Create a mount point by entering:
2. After that, mount the partition by using the following command:
Note: Replace [mountpoint] with the preferred mount point (example: /usr/media ).
There is no output if the process completes successfully.
3. Verify if the partition is mounted using the following command:
The expected output is:
Understanding the Linux File System
Choosing the right file system before formatting a storage disk is crucial. Each type of file system has different file size limitations or different operating system compatibility.
The most commonly used file systems are:
Their main features and differences are:
File System | Supported File Size | Compatibility | Ideal Usage |
FAT32 | up to 4 GB | Windows, Mac, Linux | For maximum compatibility |
NTFS | 16 EiB – 1 KB | Windows, Mac (read-only), most Linux distributions | For internal drives and Windows system file |
Ext4 | 16 GiB – 16 TiB | Windows, Mac, Linux (requires extra drivers to access) | For files larger than 4 GB |
Note: Refer to our Introduction to Linux File System article to learn more about the evolution and features of different Linux file systems.
After following this tutorial, you should be able to format and mount a partition in Linux in various file systems. Partition manipulation is essential for efficient data management, and next, we recommend learning how to delete a partition in Linux.
Источник