Linux Tutorials - Herong's Tutorial Examples - v5.37, by Dr. Herong Yang
Reformat NTFS Partition into EXT4 Partition
Provides a tutorial example on how to reformat a NTFS partition into a EXT4 partition on Linux system using the 'fsmk -t ext4' command.
In an earlier tutorial, we learned how to mount NTFS partition (a partition formatted as NTFS file system) on a Linux system. Use can continue to use the NTFS partition to read and write files without any problem. But its ownership is limited to a single user and a single group.
If want to want to use this NTFS partition as a Linux native partition, you can reformat it into an EXT4 partition as described below:
1. Verify the partition type, size and location.
herong$ sudo fdisk -l /dev/sda Device Boot Start End Sectors Size Id Type /dev/sda5 167778304 1748721663 1580943360 753.9G 7 HPFS/NTFS/exFAT
2. Mount the partition to backup its data.
herong$ sudo mount -t ntfs-3g /dev/sda5 /mnt/temp herong$ sudo cd /mnt/temp herong$ sudo tar -c -z -f /mnt/backup/sda6.tar.gz * herong$ sudo rm -R /mnt/temp/*
3. Make sure the partition is empty. The output of the "df" command shows 434,820 KB used by the file system over head for journaling.
herong$ ls -l /mnt/temp total 0 herong$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda5 790471676 434820 790036856 1% /mnt/temp
4. Reformat the partition after un-mounting it.
herong$ sudo umount /dev/sda5 herong$ sudo mkfs -t ext4 /dev/sda5 mke2fs 1.44.6 (5-Mar-2019) /dev/sda5 contains a ntfs file system labelled 'FTP' Proceed anyway? (y,N) y Creating filesystem with 197617920 4k blocks and 49405952 inodes Filesystem UUID: 3b893ba9-9bde-48ad-a85e-... Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000 Allocating group tables: done Writing inode tables: done Creating journal (262144 blocks): done Writing superblocks and filesystem accounting information: done
5. Verify formatting result. I see that the partition type is still labeled as "HPFS/NTFS/exFAT" in the "fdisk" output. Hope it will not cause any problems.
herong$ sudo parted /dev/sda print Number Start End Size Type File system Flags 5 85.9GB 895GB 809GB logical ext4 herong$ sudo fdisk -l /dev/sda Device Boot Start End Sectors Size Id Type /dev/sda5 167778304 1748721663 1580943360 753.9G 7 HPFS/NTFS/exFAT fdisk information out of synch hope it will impact any I/O operations
6. Change the partition label to "data".
herong$ sudo e2label /dev/sda5 data
7. Do some input/output test after mounting it.
herong$ sudo mount /dev/sda5 /mnt/temp herong$ cd /mnt/temp herong$ sudo touch junk herong$ ls -l total 16 -rw-r--r--. 1 root root 0 Nov 2 05:14 junk drwx------. 2 root root 16384 Nov 2 04:51 lost+found
Cool. Everything looks good. Note that the "lost+found" directory on the partition is to store orphaned blocks found during the "fsck" process.
Table of Contents