Index: head/usr.sbin/makefs/msdos.h =================================================================== --- head/usr.sbin/makefs/msdos.h +++ head/usr.sbin/makefs/msdos.h @@ -51,6 +51,7 @@ size_t cn_namelen; }; +int msdosfs_fsiflush(struct msdosfsmount *); struct msdosfsmount *msdosfs_mount(struct vnode *); int msdosfs_root(struct msdosfsmount *, struct vnode *); Index: head/usr.sbin/makefs/msdos.c =================================================================== --- head/usr.sbin/makefs/msdos.c +++ head/usr.sbin/makefs/msdos.c @@ -203,6 +203,8 @@ errx(1, "Image file `%s' not created.", image); TIMER_RESULTS(start, "msdos_populate_dir"); + if (msdosfs_fsiflush(pmp) != 0) + errx(1, "Unable to update FSInfo block."); if (debug & DEBUG_FS_MAKEFS) putchar('\n'); Index: head/usr.sbin/makefs/msdos/msdosfs_vfsops.c =================================================================== --- head/usr.sbin/makefs/msdos/msdosfs_vfsops.c +++ head/usr.sbin/makefs/msdos/msdosfs_vfsops.c @@ -359,3 +359,33 @@ vp->v_data = ndep; return 0; } + +/* + * If we have an FSInfo block, update it. + */ +int +msdosfs_fsiflush(struct msdosfsmount *pmp) +{ + struct fsinfo *fp; + struct buf *bp; + int error; + + if (pmp->pm_fsinfo == 0 || (pmp->pm_flags & MSDOSFS_FSIMOD) == 0) { + error = 0; + goto out; + } + error = bread(pmp->pm_devvp, pmp->pm_fsinfo, pmp->pm_BytesPerSec, + NOCRED, &bp); + if (error != 0) { + brelse(bp); + goto out; + } + fp = (struct fsinfo *)bp->b_data; + putulong(fp->fsinfree, pmp->pm_freeclustercount); + putulong(fp->fsinxtfree, pmp->pm_nxtfree); + pmp->pm_flags &= ~MSDOSFS_FSIMOD; + error = bwrite(bp); + +out: + return (error); +}