summaryrefslogtreecommitdiff
path: root/sbin/mdmfs
Commit message (Collapse)AuthorAgeFilesLines
* mdmfs(8): Fix an issue reported by mandocGordon Bergling2020-10-031-1/+1
| | | | | | | | | - whitespace at end of input line MFC after: 1 week Notes: svn path=/head/; revision=366410
* mdmfs(8): add -k skel option to populate fs from a skeletonKyle Evans2019-11-012-5/+35
| | | | | | | | | | | | | | | | | | | | | | | mdmfs(8) lacks the ability to populate throwaway memory filesystems from an existing directory. This features permits an interesting setup where /var for instance lives on a device where wear-leveling is something you want to avoid as much as possible and nonetheless you don't want to lose your logs, ports metadata, etc. Here are the steps: 1. Copy /var to /var.bak; 2. Mount an mfs into /var using -k /var.bak at startup; 3. Synchronize /var to /var.bak weekly and on shutdown. Note that this more or less mimics OpenBSD's mount_mfs(8) -P flag. PR: 146254 Submitted by: jlh (many moons ago) MFC after: 1 week Notes: svn path=/head/; revision=354236
* mdmfs(8): use -o reserve with malloc-backed md(4)Kyle Evans2019-02-161-0/+1
| | | | | | | | | | | | | Mentioned in mdconfig(8), malloc-backed md(4) can be unstable unless required memory is allocated up front with -o reserve. Furthermore, panics have been observed with md used in fstab on 12.0-RELEASE. Choose the stable route and pass -o reserve. Submitted by: Paul Vixie MFC after: 1 week Notes: svn path=/head/; revision=344218
* mdmfs: Fix many bugs in automatic md(4) creation.Brooks Davis2019-02-111-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | This code allocated a correctly sized buffer, read past the end of the source buffer, writing off the end of the target buffer, and then writing a '\0' terminator past the end of the target buffer (in the wrong place). It then leaked the buffer. Switch to a statically sized buffer on the stack and update the source pointer and length before use so the correct things are copied. Fix a logic error in the checks that the format of the line is as expected and move on out of an assert. Remove an unneeded close(). fclose() closes the descriptor. Found with: CheriABI Obtained from: CheriBSD Reviewed by: kib, jhb, markj Differential Revision: https://reviews.freebsd.org/D19122 Notes: svn path=/head/; revision=344023
* mdmfs(8): Check for other types of helper-program failureConrad Meyer2018-10-201-10/+49
| | | | | | | | | | | | | | | | | | | | | Exiting with a signal should not be treated the same as successful exit with zero status. Return signal exit information to the callers via negative integers, to enable distinction from normal exit statuses. (All consumers that check for errors don't care what the exact non-zero exit value is -- in such a case they print a diagnostic message and either continue or bail.) Additionally, check for unexpected sources of waitpid() wakeup and bail if we encounter them. Reported by: lev@ Reviewed by: kib, lev, markj (earlier version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D17035 Notes: svn path=/head/; revision=339494
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Initialize mdsize to make gcc happy again. This fixes buildworld on powerpc.Andreas Tobler2017-09-301-0/+1
| | | | | | | Reviewed by: ian@ Notes: svn path=/head/; revision=324125
* Enhance mdmfs(8) to work with tmpfs(5).Ian Lepore2017-09-292-50/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Existing scripts and associated config such as rc.initdiskless, rc.d/var, and others, use mdmfs to create memory filesystems. That program accepts a size argument which allows SI suffixes and treats an unsuffixed number as a count of 512 byte sectors. That makes it difficult to convert existing scripts to use tmpfs instead of mdmfs, because tmpfs treats unsuffixed numbers as a count of bytes. The script logic to deal with existing user config that might include suffixed and unsuffixed numbers is... unpleasant. Also, there is no g'tee that tmpfs will be available. It is sometimes configured out of small-resource embedded systems to save memory and flash storage space. These changes enhance mdmfs(8) so that it accepts two new values for the 'md-device' arg: 'tmpfs' and 'auto'. With tmpfs, the program always uses tmpfs(5) (and fails if it's not available). With 'auto' the program prefers tmpfs, but falls back to using md(4) if tmpfs isn't available. It also handles the -s <size> argument so that the mdconfig interpetation of unsuffixed numbers applies when tmpfs is used as well, so that existing user config keeps working after a switch to tmpfs. A new rc setting, mfs_type, is added to etc/defaults/rc.conf to let users force the use of tmpfs or md; the default value is "auto". Differential Revision: https://reviews.freebsd.org/D12301 Notes: svn path=/head/; revision=324107
* Add missing history sections to a number of storage related man pagesAllan Jude2016-09-161-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gmultipath.8: Add HISTORY Adjust sentences with bad phrases picked up by igor ggatec.8: Add HISTORY ggated.8: Add HISTORY ggatel.8: Add HISTORY Seperate out sentence as advised by igor. hastctl.8: Add HISTORY hastd.8: Add HISTORY Fix sentence highlighted by igor. iscontrol.8: Add HISTORY mdmfs.8: Add HISTORY Address issues raised by igor mount_nfs.8: Add HISTORY Not sure where mount_nfs first showed up, but the verison used in the BSD's originates from 4.4BSD according to CSRG archive. Though commercial offerings from Sun and others covers older systems, eg https://groups.google.com/forum/#!topic/net.unix-wizards/lMe7aQikqJI nandfs.8: Add HISTORY Adjust sentence in description to address bad phrase highlighted by igor. nvmecontrol.8: Add HISTORY PR: 212491 PR: 212498 PR: 212499 PR: 212500 PR: 212501 PR: 212502 PR: 212505 PR: 212508 PR: 212540 PR: 212543 PR: 212546 Submitted by: Sevan Janiyan <venture37@geeklan.co.uk> Notes: svn path=/head/; revision=305861
* MFHGlen Barber2016-03-142-8/+31
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296869
| * - Implement -T option to allow to specify a fs type for a vnode-backed ↵Alex Kozlov2016-03-112-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | memory disk - Rephrase -t option description (manpage) - Split long sentences (manpage) Differential Review: https://reviews.freebsd.org/D4394 Reviewed by: mav, wblock (manpage) Approved by: mav Notes: svn path=/head/; revision=296648
* | MFHGlen Barber2016-03-071-5/+6
|\| | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296457
| * Update meaning of -n argument.Alexander Motin2016-03-071-5/+6
| | | | | | | | | | | | | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=296449
* | Explicitly add more files to the 'runtime' package.Glen Barber2016-02-091-0/+1
|/ | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295450
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
|/ | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* Remove trailing whitespace per mdoc lint warningEitan Adler2012-03-291-4/+4
| | | | | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days Notes: svn path=/head/; revision=233648
* Spelling fixes for sbin/Ulrich Spörlein2012-01-071-1/+1
| | | | Notes: svn path=/head/; revision=229778
* Do not try to change the mode or ownership of the root of the mountpointKonstantin Belousov2011-09-131-0/+27
| | | | | | | | | | | | when newly established mdmfs mount is readonly. PR: bin/128427 Tested and reviewed by: jchandra MFC after: 1 week Approved by: re (bz) Notes: svn path=/head/; revision=225534
* dd -t switch for mdmfs to enable TRIM on the configured filesystem.Konstantin Belousov2011-09-062-6/+16
| | | | | | | | | | | While there, fix minor style issues. Submitted by: Alex Kozlov <spam rm-rf kiev ua> MFC after: 1 week Approved by: re (bz) Notes: svn path=/head/; revision=225416
* Switch the default WARNS level for sbin/ to 6.Ruslan Ermilov2009-10-191-1/+0
| | | | | | | Submitted by: Ulrich Spörlein Notes: svn path=/head/; revision=198236
* -n is used by newfs to tell "do not generate a .snap directory" instead ofRemko Lodder2007-05-141-4/+4
| | | | | | | | | | | specifying rotational-positions, reflect that in the command arguments. PR: bin/110178 Submitted by: Alex Kozlov <spam at rm-rf dot kiev dot ua> Approved by: imp (mentor) Notes: svn path=/head/; revision=169560
* Fix a typo: argv -> argvpYaroslav Tykhiy2007-04-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Rationale: We are interested in the current (last) element of the argv array there, not in its first element. The if construct is there because we want to avoid adding empty (zero-length) arguments to argv, so we just don't advance argvp if the current argument is empty, and it gets overwritten at the next iteration. Note that strsep(3) doesn't treat consecutive delim characters as a single separator, it returns empty fields between such characters, and it's up to the caller to handle them this or that way. Also add a comment that the argv array ends up null-terminated in any case (it's due to the design of the for loop) as an answer to a possible question why the whole argv isn't zero-filled. Submitted by: yongari Tested by: yongari MFC after: 3 days Notes: svn path=/head/; revision=169129
* Don't leave a NULL value in mdsuffix when a particular mdYaroslav Tykhiy2007-03-071-2/+1
| | | | | | | | | | | | unit w/o suffix is specified. It had better be an empty string as it will be passed to a printf-like function that builds the command line to run. PR: kern/109863 MFC after: 1 week Notes: svn path=/head/; revision=167286
* Grammar nits.Ceri Davies2007-02-151-2/+2
| | | | Notes: svn path=/head/; revision=166772
* Add examples for configuring and mounting geom_uzip(4) based disks'Matteo Riondato2007-02-151-0/+20
| | | | | | | | image and sliced/partitioned memory disks. MFC after: 1 week Notes: svn path=/head/; revision=166765
* Correct -c and -d description.Matteo Riondato2007-02-152-16/+16
| | | | | | | | | | Other requests made in the PR were already solved in the past. PR: bin/66763 MFC after: 1 week Notes: svn path=/head/; revision=166752
* Enhances mdmfs(8) to mount md-based device such as uzip.Matteo Riondato2007-02-151-4/+9
| | | | | | | | | | Examples of use can be found in the PR text. PR: 103501 MFC after: 1 week Notes: svn path=/head/; revision=166749
* Remove the -C option as it does more harm than good. To be fullyRuslan Ermilov2006-11-032-80/+15
| | | | | | | | | | | | | | | | | | | | | | | compatible, it would have to (at least): - support the "compat-compat" -T option, - *not* support the -l, -O, and -v options, - default to soft updates being disabled. Worse, the compatibility mode makes it impossible to mount_mfs(8) a file system from fstab(5) with soft updates disabled (-S). [1] Now, the only difference when called as "mount_mfs" or "mfs" (as opposed to "mdmfs") is that the file mode of the mount point is set by default to 01777. All options available to mdmfs(8) are also available to mount_mfs(8); the -C option is still recognized but ignored for backward compatibility. PR: bin/98860 [1] MFC after: 2 weeks Notes: svn path=/head/; revision=163952
* Fix .Dd arguments.Ruslan Ermilov2006-10-211-1/+1
| | | | Notes: svn path=/head/; revision=163576
* The UFS filesystem get created only if -P was not specified.Matteo Riondato2006-10-011-2/+4
| | | | | | | | | Specify this on the description MFC after: 3 days Notes: svn path=/head/; revision=162921
* Markup fixes.Ruslan Ermilov2006-09-181-2/+2
| | | | Notes: svn path=/head/; revision=162395
* Add new -E option, which allows to specify location of the mdconfig(8)Maxim Sobolev2006-02-162-8/+20
| | | | | | | | | utility instead of using default _PATH_MDCONFIG (/sbin/mdconfig). MFC after: 1 week Notes: svn path=/head/; revision=155769
* Add a -P option to allow skipping newfs when using a vnode-backedDima Dorfman2006-01-022-6/+22
| | | | | | | | | | | | | | | | | | | | disk. Apparently some people want to use mdmfs as mount_* as a shortcut for mounting existing file-based file systems. Note that unlike in the patches from the submitters, this option is not available in compat mode. Compat mode was supposed to support only things that mount_mfs used to support. To use this option from fstab, mdmfs should be called mount_md, not mount_mfs. This distinction has not always upkept for new options, and those can't be fixed now without breaking people's systems, but new options should not usually be allowed in compat mode. (Not sure why -F is allowed there at all.) PR: 57641 Submitted by: Ruben de Groot Submitted independently by: Wojciech A. Koszek, for Urzad Miasta Czestochowa Notes: svn path=/head/; revision=153961
* If we're operating without running external programs (-N) andDima Dorfman2005-12-221-1/+1
| | | | | | | | | | autonumbering is requested, set the unit to 0 instead of -1. This option is just for output, and "/dev/md-1" looks disconcerting. Submitted by: Wojciech A. Koszek Notes: svn path=/head/; revision=153637
* Fix parsing of mdmfs(8) option "-w <user>:<group>" in case <user> orRalf S. Engelschall2005-10-141-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | <group> is a numeric user/group ID instead of a user/group name (as explicitly intended to be allowed by both the manual page and the implementation). Before this fix, mdmfs(8) aborted: | # mdmfs -s 32m -w 0:0 md /var/tmp/foo | Assertion failed: (mip->mi_have_uid), function extract_ugid, file /usr/src/sbin/mdmfs/mdmfs.c, line 555. | Abort trap (core dumped) The "mi_have_[ug]id" fields were only set in case a name lookup was successful. Instead they also have to be set in case the string to integer conversion was successful. Additionally, as a result of this fix, two assertions at the end of the function are now always true and hence can be just be removed. It is guarrantied that both the UID and the GID are set when the function returns regularily, else it would have been already bailed out with usage()/exit(3) or errx(3) before. Spotted by: Christoph Schug <chris@schug.net> MFC after: 3 days Notes: svn path=/head/; revision=151315
* Sync program's usage() with manpage's SYNOPSIS.Ruslan Ermilov2005-02-101-4/+4
| | | | Notes: svn path=/head/; revision=141611
* Remove unsigned casts.Suleiman Souhlal2005-01-311-4/+8
| | | | | | | | Discussed with: delphij, stefanf Approved by: grehan (mentor) Notes: svn path=/head/; revision=141082
* - Make WARNS?= 6 cleanSuleiman Souhlal2005-01-252-2/+4
| | | | | | | | | - Add WARNS?= 6 Approved by: stefanf, grehan (mentor) Notes: svn path=/head/; revision=140815
* Assorted markup, grammar, and spelling fixes.Ruslan Ermilov2004-05-171-5/+4
| | | | Notes: svn path=/head/; revision=129327
* Added -l to usage().Ruslan Ermilov2004-05-171-2/+2
| | | | Notes: svn path=/head/; revision=129322
* Add a "-l" parameter to mdmfs so that memory file systems can beRobert Watson2004-02-262-1/+7
| | | | | | | | | | | created with the multilabel flag from inception. This simply passes the "-l" flag on to newfs(8). Obtained from: TrustedBSD Project Sponsored by: DARPA, McAfee Research Notes: svn path=/head/; revision=126255
* Userland signed char fixes for PPC build. Problems were using a charPeter Grehan2004-01-221-1/+2
| | | | | | | | | | | | return for getopt() and comparing to -1, ditto with fgetc() and EOF, and using the kg_nice value from <sys/user.h> Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at> Reviewed by: obrien, bde (a while back) Tested lightly on: ppc, i386, make universe Notes: svn path=/head/; revision=124830
* Don't reinvent the wheel: Use setmode(3) to interpretYaroslav Tykhiy2003-08-052-3/+15
| | | | | | | | | a file mode specification from the command line. This approach is more flexible and less error-prone than using a mere strtoul(3). Notes: svn path=/head/; revision=118500