info-mtools
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Info-mtools] Bug: mformat does not format FAT32 correctly


From: Pali Rohár
Subject: Re: [Info-mtools] Bug: mformat does not format FAT32 correctly
Date: Sat, 11 Aug 2018 15:42:51 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Monday 04 December 2017 19:29:53 Pali Rohár wrote:
> 1) mformat is not able to format disk images without specifying C/H/S
> geometry. Nowadays there is no hard disk or SSD disk which use C/H/S
> geometry and therefore asking user for such thing does not make sense.
> 
> So what I used is to specify 64 heads and 32 sectors per track just to
> easily calculates number of tracks on disk. For disk with logical sector
> size as 512 bytes (which is probably for all HDD and SSD), number of
> tracks would be size of disk in megabytes (64*32*512 = 1 megabyte).
> 
> So mformat parameters: -h 64 -s 32 -t SIZE_IN_MB
> Probably it is also needed to specify (for hard disks): -m 0xf8
> 
> If you do not enter this C/H/S geometry mformat just show error message:
> 
> mformat: Unknown geometry (You must tell the complete geometry of the
> disk, either in /etc/mtools.conf or on the command line)
> 
> I think that except this error message, mformat for hard drives should
> use above C/H/S auto-calculation.

Hi! In attachment is a patch which automatically calculates C/H/S
geometry based on LBA Assist Translation formula just from the size of
disk. So formatting non-C/H/S disks (today *all* disks) via mformat is
automatic without need to specify C/H/S numbers. This applies also for
disk images.

This patch also adds support for detecting logical sector size of disk
and propagates it to FAT sector size. This is needed for a new Native 4K
disks which have sector size 4096 bytes (and not 512).

So with this patch (and previous one) is formatting Native 4K disk of
16 TB to FAT32 easily, just with command:

$ mformat -F :: -i /dev/sdc

-- 
Pali Rohár
address@hidden

Attachment: mtools_lba.patch
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]