Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions distrib/sets/lists/base/mi
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@
./sbin/mount_fdesc base-miscfs-root fdescfs
./sbin/mount_ffs base-sysutil-root
./sbin/mount_filecore base-filecorefs-root filecorefs
./sbin/mount_full base-miscfs-root fullfs
./sbin/mount_hfs base-hfs-root hfs
./sbin/mount_hfsp base-obsolete obsolete
./sbin/mount_kernfs base-sysutil-root kernfs
Expand Down Expand Up @@ -1128,6 +1129,7 @@
./usr/include/miscfs base-c-usr
./usr/include/miscfs/fdesc base-c-usr
./usr/include/miscfs/fifofs base-c-usr
./usr/include/miscfs/fullfs base-c-usr
./usr/include/miscfs/genfs base-c-usr
./usr/include/miscfs/kernfs base-c-usr
./usr/include/miscfs/nullfs base-c-usr
Expand Down
3 changes: 3 additions & 0 deletions distrib/sets/lists/base/shl.mi
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,9 @@
./usr/lib/librumpfs_ffs.so base-rump-shlib rump
./usr/lib/librumpfs_ffs.so.0 base-rump-shlib rump
./usr/lib/librumpfs_ffs.so.0.0 base-rump-shlib rump
./usr/lib/librumpfs_full.so base-rump-shlib rump
./usr/lib/librumpfs_full.so.0 base-rump-shlib rump
./usr/lib/librumpfs_full.so.0.0 base-rump-shlib rump
./usr/lib/librumpfs_hfs.so base-rump-shlib rump
./usr/lib/librumpfs_hfs.so.0 base-rump-shlib rump
./usr/lib/librumpfs_hfs.so.0.0 base-rump-shlib rump
Expand Down
3 changes: 3 additions & 0 deletions distrib/sets/lists/comp/mi
Original file line number Diff line number Diff line change
Expand Up @@ -2786,6 +2786,7 @@
./usr/include/milter/mfdef.h comp-obsolete obsolete
./usr/include/miscfs/fdesc/fdesc.h comp-c-include
./usr/include/miscfs/fifofs/fifo.h comp-c-include
./usr/include/miscfs/fullfs/full.h comp-c-include
./usr/include/miscfs/genfs/genfs.h comp-c-include
./usr/include/miscfs/genfs/genfs_node.h comp-c-include
./usr/include/miscfs/genfs/layer.h comp-c-include
Expand Down Expand Up @@ -4338,6 +4339,8 @@
./usr/lib/librumpfs_fdesc_p.a comp-c-proflib rump,profile
./usr/lib/librumpfs_ffs.a comp-c-lib rump
./usr/lib/librumpfs_ffs_p.a comp-c-proflib rump,profile
./usr/lib/librumpfs_full.a comp-c-lib rump,fullfs
./usr/lib/librumpfs_full_p.a comp-c-proflib rump,fullfs,profile
./usr/lib/librumpfs_hfs.a comp-c-lib rump
./usr/lib/librumpfs_hfs_p.a comp-c-proflib rump,profile
./usr/lib/librumpfs_kernfs.a comp-c-lib rump
Expand Down
2 changes: 2 additions & 0 deletions distrib/sets/lists/debug/mi
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@
./usr/libdata/debug/sbin/mount_fdesc.debug comp-miscfs-debug fdescfs,debug
./usr/libdata/debug/sbin/mount_ffs.debug comp-sysutil-debug debug
./usr/libdata/debug/sbin/mount_filecore.debug comp-filecorefs-debug filecorefs,debug
./usr/libdata/debug/sbin/mount_full.debug comp-miscfs-debug fullfs,debug
./usr/libdata/debug/sbin/mount_hfs.debug comp-hfs-debug hfs,debug
./usr/libdata/debug/sbin/mount_kernfs.debug comp-sysutil-debug kernfs,debug
./usr/libdata/debug/sbin/mount_lfs.debug comp-sysutil-debug lfs,debug
Expand Down Expand Up @@ -1714,6 +1715,7 @@
./usr/libdata/debug/usr/tests/fs/ffs/t_snapshot_v2.debug tests-fs-debug debug,atf,rump
./usr/libdata/debug/usr/tests/fs/ffs/t_update_log.debug tests-fs-debug debug,atf,rump
./usr/libdata/debug/usr/tests/fs/fifofs/t_fifo.debug tests-fs-debug debug,atf,rump
./usr/libdata/debug/usr/tests/fs/fullfs/t_basic.debug tests-fs-debug fullfs,debug,atf,rump
./usr/libdata/debug/usr/tests/fs/hfs/t_pathconvert.debug tests-fs-debug hfs,debug,atf,rump
./usr/libdata/debug/usr/tests/fs/kernfs/t_basic.debug tests-fs-debug kernfs,debug,atf,rump
./usr/libdata/debug/usr/tests/fs/lfs/t_basic.debug tests-fs-debug lfs,debug,atf,rump
Expand Down
2 changes: 2 additions & 0 deletions distrib/sets/lists/debug/module.mi
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
./usr/libdata/debug/@MODULEDIR@/flash/flash.kmod.debug modules-base-kernel kmod,debug
./usr/libdata/debug/@MODULEDIR@/fss modules-base-kernel kmod,debug
./usr/libdata/debug/@MODULEDIR@/fss/fss.kmod.debug modules-base-kernel kmod,debug
./usr/libdata/debug/@MODULEDIR@/full modules-base-kernel kmod,debug
./usr/libdata/debug/@MODULEDIR@/full/full.kmod.debug modules-base-kernel kmod,debug
./usr/libdata/debug/@MODULEDIR@/gpio modules-base-kernel kmod,debug
./usr/libdata/debug/@MODULEDIR@/gpio/gpio.kmod.debug modules-base-kernel kmod,debug
./usr/libdata/debug/@MODULEDIR@/gpioiic modules-base-kernel kmod,debug
Expand Down
2 changes: 2 additions & 0 deletions distrib/sets/lists/man/mi
Original file line number Diff line number Diff line change
Expand Up @@ -3100,6 +3100,7 @@
./usr/share/man/cat8/mount_fdesc.0 man-miscfs-catman fdescfs,.cat
./usr/share/man/cat8/mount_ffs.0 man-sysutil-catman .cat
./usr/share/man/cat8/mount_filecore.0 man-filecorefs-catman filecorefs,.cat
./usr/share/man/cat8/mount_full.0 man-miscfs-catman fullfs,.cat
./usr/share/man/cat8/mount_hfs.0 man-hfs-catman hfs,.cat
./usr/share/man/cat8/mount_hfsp.0 man-obsolete obsolete
./usr/share/man/cat8/mount_kernfs.0 man-sysutil-catman kernfs,.cat
Expand Down Expand Up @@ -6693,6 +6694,7 @@
./usr/share/man/man8/mount_fdesc.8 man-miscfs-man fdescfs,.man
./usr/share/man/man8/mount_ffs.8 man-sysutil-man .man
./usr/share/man/man8/mount_filecore.8 man-filecorefs-man filecorefs,.man
./usr/share/man/man8/mount_full.8 man-miscfs-man fullfs,.man
./usr/share/man/man8/mount_hfs.8 man-hfs-man hfs,.man
./usr/share/man/man8/mount_hfsp.8 man-obsolete obsolete
./usr/share/man/man8/mount_kernfs.8 man-sysutil-man kernfs,.man
Expand Down
1 change: 1 addition & 0 deletions distrib/sets/lists/manhtml/mi
Original file line number Diff line number Diff line change
Expand Up @@ -2776,6 +2776,7 @@
./usr/share/man/html8/mount_fdesc.html man-miscfs-htmlman fdescfs,html
./usr/share/man/html8/mount_ffs.html man-sysutil-htmlman html
./usr/share/man/html8/mount_filecore.html man-filecorefs-htmlman filecorefs,html
./usr/share/man/html8/mount_full.html man-miscfs-htmlman fullfs,html
./usr/share/man/html8/mount_hfs.html man-hfs-htmlman hfs,html
./usr/share/man/html8/mount_kernfs.html man-sysutil-htmlman kernfs,html
./usr/share/man/html8/mount_lfs.html man-sysutil-htmlman lfs,html
Expand Down
2 changes: 2 additions & 0 deletions distrib/sets/lists/modules/mi
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@
./@MODULEDIR@/flash/flash.kmod modules-base-kernel kmod
./@MODULEDIR@/fss modules-base-kernel kmod
./@MODULEDIR@/fss/fss.kmod modules-base-kernel kmod
./@MODULEDIR@/full modules-base-kernel kmod
./@MODULEDIR@/full/full.kmod modules-base-kernel kmod
./@MODULEDIR@/gpio modules-base-kernel kmod
./@MODULEDIR@/gpio/gpio.kmod modules-base-kernel kmod
./@MODULEDIR@/gpioiic modules-base-kernel kmod
Expand Down
5 changes: 5 additions & 0 deletions distrib/sets/lists/tests/mi
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
./usr/libdata/debug/usr/tests/fs/cd9660 tests-fs-debug compattestfile,atf
./usr/libdata/debug/usr/tests/fs/ffs tests-fs-debug compattestfile,atf
./usr/libdata/debug/usr/tests/fs/fifofs tests-fs-debug compattestfile,atf
./usr/libdata/debug/usr/tests/fs/fullfs tests-fs-debug compattestfile,atf
./usr/libdata/debug/usr/tests/fs/hfs tests-fs-debug compattestfile,atf
./usr/libdata/debug/usr/tests/fs/kernfs tests-fs-debug compattestfile,atf
./usr/libdata/debug/usr/tests/fs/lfs tests-fs-debug compattestfile,atf
Expand Down Expand Up @@ -1682,6 +1683,10 @@
./usr/tests/fs/fifofs/Atffile tests-fs-tests atf,rump
./usr/tests/fs/fifofs/Kyuafile tests-fs-tests atf,rump,kyua
./usr/tests/fs/fifofs/t_fifo tests-fs-tests atf,rump
./usr/tests/fs/fullfs tests-fs-tests compattestfile,atf
./usr/tests/fs/fullfs/Atffile tests-fs-tests atf,rump
./usr/tests/fs/fullfs/Kyuafile tests-fs-tests atf,rump,kyua
./usr/tests/fs/fullfs/t_basic tests-fs-tests atf,rump
./usr/tests/fs/h_funcs.subr tests-fs-tests atf,rump
./usr/tests/fs/hfs tests-fs-tests compattestfile,atf
./usr/tests/fs/hfs/Atffile tests-fs-tests atf,rump
Expand Down
2 changes: 2 additions & 0 deletions etc/mtree/NetBSD.dist.tests
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
./usr/libdata/debug/usr/tests/fs/cd9660
./usr/libdata/debug/usr/tests/fs/ffs
./usr/libdata/debug/usr/tests/fs/fifofs
./usr/libdata/debug/usr/tests/fs/fullfs
./usr/libdata/debug/usr/tests/fs/hfs
./usr/libdata/debug/usr/tests/fs/kernfs
./usr/libdata/debug/usr/tests/fs/lfs
Expand Down Expand Up @@ -235,6 +236,7 @@
./usr/tests/fs/cd9660
./usr/tests/fs/ffs
./usr/tests/fs/fifofs
./usr/tests/fs/fullfs
./usr/tests/fs/hfs
./usr/tests/fs/kernfs
./usr/tests/fs/lfs
Expand Down
4 changes: 4 additions & 0 deletions sbin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ SUBDIR+= mount_ntfs
SUBDIR+= mount_null
.endif

.if (${MKFULLFS} != "no")
SUBDIR+= mount_full
.endif

.if (${MKOVERLAYFS} != "no")
SUBDIR+= mount_overlay
.endif
Expand Down
16 changes: 16 additions & 0 deletions sbin/mount_full/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# $NetBSD$

.include <bsd.own.mk>

PROG= mount_full
SRCS= mount_full.c pathadj.c
MAN= mount_full.8

MOUNT= ${NETBSDSRCDIR}/sbin/mount
CPPFLAGS+= -I${NETBSDSRCDIR}/sys -I${MOUNT}
.PATH: ${MOUNT}

DPADD+=${LIBUTIL}
LDADD+=-lutil

.include <bsd.prog.mk>
151 changes: 151 additions & 0 deletions sbin/mount_full/mount_full.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
.\" $NetBSD$
.\"
.\" Copyright (c) 1992, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software donated to Berkeley by
.\" Jan-Simon Pendry.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd March 6, 2026
.Dt MOUNT_FULL 8
.Os
.Sh NAME
.Nm mount_full
.Nd mount a disk-full simulation filesystem layer
.Sh SYNOPSIS
.Nm
.Op Fl o Ar options
.Ar target
.Ar mount-point
.Sh DESCRIPTION
The
.Nm
command mounts a
.Em fullfs
layer over
.Ar target ,
making it accessible at
.Ar mount-point .
.Pp
.Em fullfs
is a stackable filesystem layer built on the same layerfs infrastructure as
.Xr mount_null 8 .
It presents the contents of
.Ar target
unchanged, but intercepts any vnode operation that would allocate disk space
and returns
.Er ENOSPC
immediately, without touching the underlying filesystem.
.Pp
This makes it possible to test an application's handling of disk-full
conditions without filling an actual disk.
.Pp
Both
.Ar target
and
.Ar mount-point
are converted to absolute paths before use.
.Sh BEHAVIOR
The following operations always fail with
.Er ENOSPC
through a fullfs mount:
.Bl -bullet -compact
.It
.Xr write 2
.It
.Xr open 2
with
.Dv O_CREAT
(new file creation)
.It
.Xr mkdir 2
.It
.Xr mknod 2
.It
.Xr symlink 2
.It
.Xr link 2
.El
.Pp
The following operations pass through to the underlying filesystem unchanged:
.Bl -bullet -compact
.It
.Xr read 2 ,
.Xr readdir 2 ,
.Xr stat 2 ,
and other read-only operations
.It
.Xr unlink 2
and
.Xr rmdir 2
(these free space rather than allocating it)
.It
.Xr rename 2
.El
.Pp
.Xr statvfs 2
reports zero free and available blocks and inodes, regardless of the
actual state of the underlying filesystem.
.Sh OPTIONS
.Bl -tag -width Fl
.It Fl o
Options are specified with a
.Fl o
flag followed by a comma-separated string of options.
See the
.Xr mount 8
man page for possible options and their meanings.
.El
.Sh EXAMPLES
Mount
.Pa /var/db
under
.Pa /mnt/full
to test how a program behaves when the database volume is full:
.Pp
.Dl mount_full /var/db /mnt/full
.Pp
Verify that the layer is working correctly:
.Bd -literal -offset indent
# Existing data is still readable:
ls /mnt/full

# Writes fail immediately:
echo hello >> /mnt/full/somefile
echo $? # non-zero; "No space left on device"

# Free space is reported as zero:
df /mnt/full
.Ed
.Sh SEE ALSO
.Xr mount 8 ,
.Xr mount_null 8
.Sh HISTORY
The
.Nm
utility first appeared in
.Nx 11 .
Loading