Bug 599464 - mkfs-b does not support vfat/ntfs
mkfs-b does not support vfat/ntfs
Status: CLOSED UPSTREAM
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
All Linux
low Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
:
Depends On:
Blocks: 600148
  Show dependency treegraph
 
Reported: 2010-06-03 06:03 EDT by Jinxin Zheng
Modified: 2011-07-14 15:12 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 600148 (view as bug list)
Environment:
Last Closed: 2011-07-14 15:12:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jinxin Zheng 2010-06-03 06:03:46 EDT
Description of problem:
mkfs-b cannot be used to create vfat or ntfs.

Version-Release number of selected component (if applicable):
libguestfs-1.3.18

How reproducible:
Always

Steps to Reproduce:
run this script in guestfish,
$ guestfish <<EOF
sparse test.img 1G
run
part-disk /dev/vda mbr
-mkfs-b vfat 4096 /dev/vda1
-mkfs-b ntfs 4096 /dev/vda1
EOF

Actual results:
guestfish outputs error with the mkfs-b command,
><fs> mkfs-b vfat 4096 /dev/vda1 
libguestfs: error: mkfs_b: vfat: /dev/vda1: mkfs.vfat: Backup boot sector must be a reserved sector
><fs> mkfs-b ntfs 4096 /dev/vda1 
libguestfs: error: mkfs_b: ntfs: /dev/vda1: Unknown option '-b'.
Cannot understand the number of sectors '/dev/vda1'.

Expected results:
no error.

Additional info:
The windows vfat and ntfs file systems have different definition for the 'block size' of unix file systems like ext2/3 -- 'sector size', which (I think) is a same concept as block size.

The mkdosfs and mkntfs utilities do not support the -b option (actually mkdosfs do have a -b option which has a completely different meaning). However, the sector sizes of the vfat and ntfs can be set via
mkdosfs -S
and
mkntfs -s

I simply tested these commands and they should just work. But it seems that the mkdosfs has limitations about the logical-sector-size and sectors-per-cluster values. I did not investigate very deep in this, should not be too complicated though.
Comment 1 Richard W.M. Jones 2010-06-03 08:18:17 EDT
(In reply to comment #0)
> Additional info:
> The windows vfat and ntfs file systems have different definition for the 'block
> size' of unix file systems like ext2/3 -- 'sector size', which (I think) is a
> same concept as block size.
> 
> The mkdosfs and mkntfs utilities do not support the -b option (actually mkdosfs
> do have a -b option which has a completely different meaning). However, the
> sector sizes of the vfat and ntfs can be set via
> mkdosfs -S
> and
> mkntfs -s

I think a closer analogy to blocksize is clustersize.
It appears that sector size should always be related
to the physical sector size of the device (ie. 512 or
4096).  We can adjust the clustersize using the
appropriate flags, and document this.

In the long term it may be better to have explicit
DOS and NTFS creation functions that allow all the
tunables to be presented.
Comment 2 Richard W.M. Jones 2010-06-03 09:56:40 EDT
Patch posted upstream:
https://www.redhat.com/archives/libguestfs/2010-June/msg00045.html
Comment 3 Jinxin Zheng 2010-06-03 23:02:36 EDT
(In reply to comment #1)
> In the long term it may be better to have explicit
> DOS and NTFS creation functions that allow all the
> tunables to be presented.

Agree this is a solution making better sense.
Comment 4 Jinxin Zheng 2010-06-03 23:04:40 EDT
(In reply to comment #2)
> Patch posted upstream:
> https://www.redhat.com/archives/libguestfs/2010-June/msg00045.html    

Tested the patches. Looks good to me.

Note You need to log in before you can comment on or make changes to this bug.