Bug 188762 - makefs(8) create bad images with UFS2. 100% reproducibility.
Summary: makefs(8) create bad images with UFS2. 100% reproducibility.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Mark Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-18 15:40 UTC by Oleg Ginzburg
Modified: 2018-01-10 15:10 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Ginzburg 2014-04-18 15:40:01 UTC
makefs(8) create bad images with UFS2. 100% reproducibility.

Fix: 

sorry
How-To-Repeat: 1) Populate some data, for example - base of FreeBSD. On the small size of data problem is not reproducible. 

% bsdinstall jail /tmp/base

2) Create image with UFS2 (on UFS1 is not reproducible) by makefs:

% makefs -o version=2 /tmp/base.img /tmp/base

3) Attach via mdconfig
% mdconfig -a -t vnode -f /tmp/base.img 
md0


4) First run fsck (FS is not consistent, why?):
% fsck_ufs -y /dev/md0  
** /dev/md0
** Last Mounted on 
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
UNALLOCATED  I=1536  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/nls/uk_UA.ISO8859-5/tcsh.cat

REMOVE? yes

UNALLOCATED  I=1537  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/nls/zh_CN.UTF-8/grep.cat

REMOVE? yes

UNALLOCATED  I=1535  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/nls/POSIX

REMOVE? yes

UNALLOCATED  I=2106  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/locale/en_CA.US-ASCII/LC_COLLATE

REMOVE? yes

UNALLOCATED  I=2107  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/locale/en_CA.US-ASCII/LC_MONETARY

REMOVE? yes

UNALLOCATED  I=2108  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/usr/share/locale/en_CA.US-ASCII/LC_CTYPE

REMOVE? yes

** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? yes

SUMMARY INFORMATION BAD
SALVAGE? yes

BLK(S) MISSING IN BIT MAPS
SALVAGE? yes

13074 files, 307370 used, 18677 free (125 frags, 2319 blocks, 0.0% fragmentation)

***** FILE SYSTEM MARKED DIRTY *****

***** FILE SYSTEM WAS MODIFIED *****

***** PLEASE RERUN FSCK *****

5) Second fsck, all clean:
% fsck_ufs -y /dev/md0
** /dev/md0
** Last Mounted on 
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
13074 files, 307370 used, 18677 free (125 frags, 2319 blocks, 0.0% fragmentation)

***** FILE SYSTEM MARKED CLEAN *****


6) Mount and unmount fs (when mount with -oro, problem is not reproducible):
% mount /dev/md0 /mnt
% umount /mnt

7)  Third run of fsck, FS is not consistent) :
fsck_ufs -y /dev/md0
** /dev/md0
** Last Mounted on /mnt
** Phase 1 - Check Blocks and Sizes
PARTIALLY ALLOCATED INODE I=128
CLEAR? yes

PARTIALLY ALLOCATED INODE I=132
CLEAR? yes

** Phase 2 - Check Pathnames
UNALLOCATED  I=128  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/var/db/etcupdate/current/usr/share/openssl/man/en.ISO8859-15

REMOVE? yes

UNALLOCATED  I=129  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/var/db/etcupdate/current/usr/share/openssl/man/en.ISO8859-1

REMOVE? yes

UNALLOCATED  I=132  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/var/db/etcupdate/current/usr/share/nls/en_US.US-ASCII

REMOVE? yes

UNALLOCATED  I=133  OWNER=root MODE=0
SIZE=0 MTIME=Mar 16 16:58 2242 
NAME=/var/db/etcupdate/current/usr/share/nls/POSIX

REMOVE? yes

UNALLOCATED  I=134  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/var/db/etcupdate/current/usr/share/man/en.UTF-8

REMOVE? yes

UNALLOCATED  I=135  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/var/db/etcupdate/current/usr/share/man/en.ISO8859-15

REMOVE? yes

** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
LINK COUNT DIR I=126  OWNER=root MODE=40755
SIZE=512 MTIME=Apr 15 01:03 2014  COUNT 4 SHOULD BE 3
ADJUST? yes

LINK COUNT DIR I=127  OWNER=root MODE=40755
SIZE=512 MTIME=Apr 15 01:03 2014  COUNT 3 SHOULD BE 2
ADJUST? yes

UNREF FILE  I=137  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

NO lost+found DIRECTORY
CREATE? yes

UNREF FILE  I=138  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=139  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=140  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=141  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=142  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=143  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=144  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=145  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? yes

SUMMARY INFORMATION BAD
SALVAGE? yes

BLK(S) MISSING IN BIT MAPS
SALVAGE? yes

13067 files, 307369 used, 18678 free (126 frags, 2319 blocks, 0.0% fragmentation)

***** FILE SYSTEM MARKED DIRTY *****

***** FILE SYSTEM WAS MODIFIED *****

***** PLEASE RERUN FSCK *****

8) And again:
root@home:/ # fsck_ufs -y /dev/md0
** /dev/md0
** Last Mounted on /mnt
** Phase 1 - Check Blocks and Sizes
PARTIALLY ALLOCATED INODE I=128
CLEAR? yes

PARTIALLY ALLOCATED INODE I=132
CLEAR? yes

** Phase 2 - Check Pathnames
UNALLOCATED  I=128  OWNER=root MODE=0
SIZE=0 MTIME=Jan  1 03:00 1970 
NAME=/lost+found

REMOVE? yes

** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
LINK COUNT DIR I=2  OWNER=root MODE=40755
SIZE=512 MTIME=Apr 18 17:58 2014  COUNT 18 SHOULD BE 17
ADJUST? yes

UNREF FILE  I=137  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

NO lost+found DIRECTORY
CREATE? yes

UNREF FILE  I=138  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=139  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=140  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=141  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=142  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=143  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=144  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

UNREF FILE  I=145  OWNER=root MODE=120755
SIZE=7 MTIME=Apr 15 01:03 2014 
RECONNECT? yes

** Phase 5 - Check Cyl groups
SUMMARY INFORMATION BAD
SALVAGE? yes

13067 files, 307369 used, 18678 free (126 frags, 2319 blocks, 0.0% fragmentation)

***** FILE SYSTEM STILL DIRTY *****

***** FILE SYSTEM WAS MODIFIED *****

***** PLEASE RERUN FSCK *****

9) And again:
fsck_ufs -y /dev/md0
** /dev/md0
Cannot find file system superblock
ioctl (GCINFO): Inappropriate ioctl for device
fsck_ufs: /dev/md0: can't read disk label


10) No superblock, no data
% mount -oro /dev/md0 /mnt
% mount: /dev/md0: Invalid argument
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:31 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 Oleg Ginzburg 2018-01-10 08:01:24 UTC
problem is solved
Comment 3 Mark Johnston freebsd_committer freebsd_triage 2018-01-10 15:10:29 UTC
This looks like the issue fixed in r326912. Sorry that this was not fixed sooner.