-   Linux - Server (
-   -   Formatting USB drive in RedHat 5 (

kreeder 12-17-2011 08:24 AM

Formatting USB drive in RedHat 5
I have a 1TB USB drive connected to a server running RedHat 5 (kernel 2.6.18-274.12.1.el5). From the factory, the drive is formatted as NTFS. Running "fdisk -l" returns:

Device Boot Start End Blocks Id System
/dev/sdc1 1 121602 976760032+ 7 HPFS/NTFS

I used "mkfs.ext3 /dev/sdc1" to format the drive as ext3 instead. I can now mount the drive and access it without any issues. However, "df -h" says the drive has a size of 917G, that 200M is used, and that 871G is available.

So, two questions:

1) Why does the drive seem to have only 871G available? The only thing on the drive is the lost+found directory which is empty.

2) After running mkfs.ext3, "fdisk -l" still reports the system type as HPFS/NTFS. Is there a way to make the system type Linux rather than HPFS/NTFS?

Thanks for the help.


sinuhe 12-17-2011 09:12 AM

partition and inode table
You need to repartition the drive for Ext (Linux partition type). Ext allocates inode table data (such as file ownership) separately, which could explain the smaller block assignment. Also, 5% is often reserved, which may explain the difference (I didn't check a calculator).

You might try XFS which dynamically allocates inodes.

michaelk 12-17-2011 09:28 AM

To elaborate you just need to change the partition ID to 83 (Linux) which isn't modified when it is formatted. Any partition tool will work i.e. fdisk, parted.

Reserved space is supposed to reduce fragmentation as well as allow root to login if the filesystem becomes full. You can use tune2fs to reduce the amount of reserved space and since this is used for data you can reduce it to zero if desired.

kreeder 12-19-2011 06:58 AM

I'm using a spare 500G USB drive to experiment. With this drive, I tried using fdisk to make a single Linux partition. I wrote the table to disk and exited. fdisk -l still reports the drive as HPFS/NTFS. However, printing the partitions in fdisk shows a single partition of type Linux. For example:

linux> fdisk -l

Device Boot Start End Blocks Id System
/dev/sdb1 1 60801 488384001 7 HPFS/NTFS

linux> fdisk /dev/sdb1
Command (m for help): p

Device Boot Start End Blocks Id System
/dev/sdb1 1 60800 488375968+ 83 Linux

So "fdisk -l" reports an end cylinder of 60801 instead of 60800 for the printed partition table; the total number of blocks reported for "fdisk -l" is also larger than those reported when printing the partition table. fdisk won't let me set the end partition to 60801 (says "Value out of range") when I try to set the partition size from cylinder 1 to cylinder 60801.

Any ideas about the discrepancy and a way to fix it?


michaelk 12-19-2011 03:39 PM

The Master boot Record / partition table is not part of any partition. Do not specify a partition number when using fdisk. i.e.

fdisk /dev/sdb

You can delete everything you created and reformatting should fix everything and since you are just experimenting no harm in deleting sdb1 and start over so you can become familiar with the process.

kreeder 12-21-2011 09:47 AM

Using "fdisk /dev/sdb" rather than "fdisk /dev/sdb1" did the trick. Now "fdisk -l" lists the drive as Linux rather than NTFS. Thanks Michaelk!


All times are GMT -5. The time now is 05:56 PM.