Bug 599464 - mkfs-b does not support vfat/ntfs
Summary: mkfs-b does not support vfat/ntfs
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 600148
TreeView+ depends on / blocked
 
Reported: 2010-06-03 10:03 UTC by Jinxin Zheng
Modified: 2011-07-14 19:12 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 600148 (view as bug list)
Environment:
Last Closed: 2011-07-14 19:12:46 UTC
Embargoed:


Attachments (Terms of Use)

Description Jinxin Zheng 2010-06-03 10:03:46 UTC
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 12:18:17 UTC
(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 13:56:40 UTC
Patch posted upstream:
https://www.redhat.com/archives/libguestfs/2010-June/msg00045.html

Comment 3 Jinxin Zheng 2010-06-04 03:02:36 UTC
(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-04 03:04:40 UTC
(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.