https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273725
Bug ID: 273725
Summary: makefs command creates corrupted UFS fs when size
option (-s) is specified
Product: Base System
Version: 13.2-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: [email protected]
Reporter: [email protected]
Verified on FreeBSD 13.2, but it happens also on freebsd 15.0-CURRENT:
makefs command executed without parameters creates a UFS clean fs as expected,
but if size option is used the fs is corrupt.
A simplified test:
root@freebsd:~ # uname -a
FreeBSD freebsd 13.2-RELEASE-p3 FreeBSD 13.2-RELEASE-p3 GENERIC amd64
E.g. I use the content of /usr/bin to fill out the new fs with makefs:
root@freebsd:~ # du -hs /usr/bin/
328M /usr/bin/
Without the -s option the fs is good:
# makefs ./image1 /usr/bin
Calculated size of `./image1': 400621568 bytes, 368 inodes
Extent size set to 32768
./image1: 382.1MB (782464 sectors) block size 32768, fragment size 4096
using 1 cylinder groups of 382.06MB, 12226 blks, 512 inodes.
super-block backups (for fsck -b #) at:
64,
Populating `./image1'
Image `./image1' complete
root@freebsd:/makefs_test # mdconfig -a -t vnode -f ./image1
md0
root@freebsd:/makefs_test # fsck /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
367 files, 83999 used, 13768 free (40 frags, 1716 blocks, 0.0% fragmentation)
***** FILE SYSTEM IS CLEAN *****
root@freebsd:/makefs_test # mount /dev/md0 /mnt
root@freebsd:/makefs_test # du -hs /mnt
328M /mnt
If any size is specified, the created fs is corrupt:
root@freebsd:/makefs_test # makefs -s 600m ./image2 /usr/bin
Calculated size of `./image2': 629145600 bytes, 368 inodes
Extent size set to 32768
density reduced from 1709635 to 8192
./image2: 600.0MB (1228800 sectors) block size 32768, fragment size 4096
using 1 cylinder groups of 600.00MB, 19200 blks, 76800 inodes.
super-block backups (for fsck -b #) at:
64,
Populating `./image2'
Image `./image2' complete
root@freebsd:/makefs_test # mdconfig -a -t vnode -f ./image2
md1
root@freebsd:/makefs_test # fsck /dev/md1
** /dev/md1
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
UFS1 cylinder group 0 failed: cgp->cg_old_niblk ("11264") != sblock.fs_ipg
("76800")
CYLINDER GROUP 0: INTEGRITY CHECK FAILED
REBUILD CYLINDER GROUP? [yn] y
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
SUMMARY INFORMATION BAD
SALVAGE? [yn] y
BLK(S) MISSING IN BIT MAPS
SALVAGE? [yn] y
367 files, 83999 used, 67176 free (40 frags, 8392 blocks, 0.0% fragmentation)
***** FILE SYSTEM IS CLEAN *****
***** FILE SYSTEM WAS MODIFIED *****
The fs is not repaired despite repeated fsck and the 'clean' final status:
root@freebsd:/makefs_test # fsck -y /dev/md1
** /dev/md1
** Last Mounted on /mnt
** Phase 1 - Check Blocks and Sizes
UFS1 cylinder group 0 failed: cgp->cg_old_niblk ("11264") != sblock.fs_ipg
("76800")
CYLINDER GROUP 0: INTEGRITY CHECK FAILED
REBUILD CYLINDER GROUP? yes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
SUMMARY INFORMATION BAD
SALVAGE? yes
BLK(S) MISSING IN BIT MAPS
SALVAGE? yes
367 files, 83999 used, 67176 free (40 frags, 8392 blocks, 0.0% fragmentation)
***** FILE SYSTEM MARKED CLEAN *****
***** FILE SYSTEM WAS MODIFIED *****
Thank you!
--
You are receiving this mail because:
You are the assignee for the bug.