Re: newfs by fstab directory name?
On Mon, Oct 27, 2003 at 01:26:23PM -0800, Wes Peters wrote: At work we do a lot of dynamic filesystem creation, so we added the ability to specify the 'special file' argument to newfs via the fstab mount point directory. Please see the attached patch. If nobody objects, I'll commit this in a couple of days. Not objecting, but I don't follow how the change is to be used. Can you post an example? ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: newfs by fstab directory name?
On Tuesday 28 October 2003 12:05, David O'Brien wrote: On Mon, Oct 27, 2003 at 01:26:23PM -0800, Wes Peters wrote: At work we do a lot of dynamic filesystem creation, so we added the ability to specify the 'special file' argument to newfs via the fstab mount point directory. Please see the attached patch. If nobody objects, I'll commit this in a couple of days. Not objecting, but I don't follow how the change is to be used. Can you post an example? Sure. Example from /etc/fstab: /dev/ad0s1d/tmpufs rw 2 2 /dev/ad0s1f/usrufs rw 2 2 /dev/ad0s1e/varufs rw 2 2 /dev/acd0 /cdrom cd9660 ro,noauto 0 0 /dev/da0s1e/spool ufs rw,noauto 0 0 The disk space on /spool is managed by the application and isn't guaranteed to be on-line or even existent when the system portion loads and starts the application. This space is entirely transient data that doesn't need to be saved across reboots. When the application starts, it checks to see if /spool is clean; if so it just mounts it, if not it newfs's it and then mounts it. This space isn't necessarily always da0s1e but it is always /spool across different hardware platforms. We prefer to: newfs /spool rather than . {some file full of shell variables describing the hardware} newfs $SPOOL_PARTITION because the former is slightly more concise. We had a local patch to do this in our 4.x code base, but it seemed a general enough change that others might find it useful as well. I recall ecountering this same problem at DoBox so it appears to be a general problem for disk-based appliances, at least if you want to support differing hardware. -- Where am I, and what am I doing in this handbasket? Wes Peters [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: newfs by fstab directory name?
Wes Peters wrote: On Tuesday 28 October 2003 12:05, David O'Brien wrote: On Mon, Oct 27, 2003 at 01:26:23PM -0800, Wes Peters wrote: At work we do a lot of dynamic filesystem creation, so we added the ability to specify the 'special file' argument to newfs via the fstab mount point directory. Please see the attached patch. If nobody objects, I'll commit this in a couple of days. Not objecting, but I don't follow how the change is to be used. Can you post an example? Sure. Example from /etc/fstab: /dev/ad0s1d/tmpufs rw 2 2 /dev/ad0s1f/usrufs rw 2 2 /dev/ad0s1e/varufs rw 2 2 /dev/acd0 /cdrom cd9660 ro,noauto 0 0 /dev/da0s1e/spool ufs rw,noauto 0 0 The disk space on /spool is managed by the application and isn't guaranteed to be on-line or even existent when the system portion loads and starts the application. This space is entirely transient data that doesn't need to be saved across reboots. When the application starts, it checks to see if /spool is clean; if so it just mounts it, if not it newfs's it and then mounts it. This space isn't necessarily always da0s1e but it is always /spool across different hardware platforms. We prefer to: newfs /spool rather than . {some file full of shell variables describing the hardware} newfs $SPOOL_PARTITION because the former is slightly more concise. We had a local patch to do this in our 4.x code base, but it seemed a general enough change that others might find it useful as well. I recall ecountering this same problem at DoBox so it appears to be a general problem for disk-based appliances, at least if you want to support differing hardware. This would also be useful for anyone doing any sort of benchmarking using data sets- I did a code port of LADDIS/SFS to Linux ages ago to do some NFS/SMB fileserver testing, and I can say, quite a LOT of entirely temporary data is generated... Scott ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to [EMAIL PROTECTED]
newfs by fstab directory name?
At work we do a lot of dynamic filesystem creation, so we added the ability to specify the 'special file' argument to newfs via the fstab mount point directory. Please see the attached patch. If nobody objects, I'll commit this in a couple of days. -- Where am I, and what am I doing in this handbasket? Wes Peters [EMAIL PROTECTED] Index: newfs.c === RCS file: /big/ncvs/src/sbin/newfs/newfs.c,v retrieving revision 1.73 diff -u -r1.73 newfs.c --- newfs.c 3 May 2003 18:41:58 - 1.73 +++ newfs.c 27 Oct 2003 21:23:45 - @@ -72,6 +72,7 @@ #include ctype.h #include err.h #include errno.h +#include fstab.h #include paths.h #include stdarg.h #include stdio.h @@ -151,6 +152,7 @@ struct disklabel *lp; struct partition oldpartition; struct stat st; + struct fstab *fst; char *cp, *special; int ch, i; off_t mediasize; @@ -264,15 +266,19 @@ usage(); special = argv[0]; - cp = strrchr(special, '/'); - if (cp == 0) { - /* - * No path prefix; try prefixing _PATH_DEV. - */ - snprintf(device, sizeof(device), %s%s, _PATH_DEV, special); - special = device; + if ((fst = getfsfile(special)) != NULL) + special = strdup(fst-fs_spec); + else { + cp = strrchr(special, '/'); + if (cp == 0) { + /* + * No path prefix; try prefixing _PATH_DEV. + */ + snprintf(device, sizeof(device), %s%s, _PATH_DEV, + special); + special = device; + } } - if (ufs_disk_fillout_blank(disk, special) == -1 || (!Nflag ufs_disk_write(disk) == -1)) { if (disk.d_error != NULL) Index: newfs.8 === RCS file: /big/ncvs/src/sbin/newfs/newfs.8,v retrieving revision 1.64 diff -u -r1.64 newfs.8 --- newfs.8 11 Oct 2003 08:24:07 - 1.64 +++ newfs.8 27 Oct 2003 21:17:17 - @@ -74,7 +74,11 @@ as the .Dq disk , although the special file need not be a physical disk. -In fact, it need not even be special.) +In fact, it need not even be special.) The special file argument +may also reference a directory the filesystem is normally mounted +on, as configured in +.Pa /etc/fstab . +.Pp Typically the defaults are reasonable, however .Nm has numerous options to allow the defaults to be selectively overridden. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: newfs by fstab directory name?
On Mon, 27 Oct 2003, Wes Peters wrote: At work we do a lot of dynamic filesystem creation, so we added the ability to specify the 'special file' argument to newfs via the fstab mount point directory. Please see the attached patch. If nobody objects, I'll commit this in a couple of days. Wouldn't this be a good candidate to be added directly to libufs? regards, le -- Lukas Ertl eMail: [EMAIL PROTECTED] UNIX Systemadministrator Tel.: (+43 1) 4277-14073 Vienna University Computer Center Fax.: (+43 1) 4277-9140 University of Vienna http://mailbox.univie.ac.at/~le/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: newfs by fstab directory name?
On Monday 27 October 2003 01:37 pm, Lukas Ertl wrote: On Mon, 27 Oct 2003, Wes Peters wrote: At work we do a lot of dynamic filesystem creation, so we added the ability to specify the 'special file' argument to newfs via the fstab mount point directory. Please see the attached patch. If nobody objects, I'll commit this in a couple of days. Wouldn't this be a good candidate to be added directly to libufs? libufs already does this sort of translation, but newfs explicitly breaks it because it needs to have the actual name of the device for some other manipulations. The alternative would be to have ufs_disk_fillout_blank et all modify their second argument, which doesn't seem like a great alternative. -- Where am I, and what am I doing in this handbasket? Wes Peters [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to [EMAIL PROTECTED]