Fdisk -l shows ext3 file system as HPFS/NTFS

ext3fdiskntfs

I have an external HDD which I formatted as NTFS partition in Windows. Now, I formatted this HDD in my linux system using the below command.

mkfs.ext3 /dev/sdb1

It was formatted successfully. However, when I run the fdisk -l command, it gives me the system as NTFS/HPFS.

   Device Boot      Start         End      Blocks   Id  System
   /dev/sdb1               1      121601   976760001   83  HPFS/NTFS

However, the command df -T /dev/sdb1 was still giving me the file system type as ext3.

Why is it not showing me the system as Linux when I run the fdisk -l command?

Best Answer

When setting up a disk or partition there are 2 aspects to doing this. The first is the act of laying down a partition table scheme on the disk using typically either MBR (Master Boot Record) or GPT (GUID Partitioning Table) formats. Both of these lay down a "structure" on the disk.

MBR

If you take a look at the structure of an MBR you'll notice that there is a section allotted for defining a partitions "type".

                          ss of layout

The valid partition types for MBR:

Command (m for help): l

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx         
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data    
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility   
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs        
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT            
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor      
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor      
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary  
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS    
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep        
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1 80  Old Minix      

So in your case the partition is identified as being of type 17.

Filesystem format

The second aspect to this is the formatting of the space within the partition itself (the filesystem). These are the filesystems that most are more familiar with when dealing with EXT3/4, etc.

So in your case you've mixed a partition type and a filesystem that generally don't go together. I should mention here that tools such as fdisk are "dumb" in the sense that they'll generally let you do whatever you want whether it makes sense to do so or not.

Changing the partition's type

So to resolve your issue you'll need to change the partition type to 83 if it's a bare partition being formatted as EXT4, or 8e if it's an LVM partition. The good news is you can use fdisk to change the partitions type through the t function:

   t   change a partition's system id

After successfully doing this your partitions should looks something like this:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048   976773119   487873536   8e  Linux LVM

What I would do!

However in your case since the partition type appears to be listed already as 83 and the partition is reported as being HPFS/NTFS, I think I'd be inclined to delete the partition(s) all together and start over with a clean slate.

Related Question