tunefs -p doesn't work for read-write mounts

2000-03-03 Thread Sheldon Hearn


Hi folks,

Shouldn't I be able to show the current tuneables for a given filesystem?

# tunefs -p /usr
tunefs: cannot work on read-write mounted file system

This is on a recent CURRENT.

Ciao,
Sheldon.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: tunefs -p doesn't work for read-write mounts

2000-03-03 Thread David Malone

On Fri, Mar 03, 2000 at 11:23:33AM +0200, Sheldon Hearn wrote:

 Shouldn't I be able to show the current tuneables for a given filesystem?
 
 # tunefs -p /usr
 tunefs: cannot work on read-write mounted file system

Tunefs seems to have had trouble with being given filesystem names
for a bit. Giving the device name works in 3.4, but not in 4.0.

David.

4.0-CURRENT:

10:04:gonzo 3# df /usr
Filesystem   1024-blocks UsedAvail Capacity  Mounted on
/dev/ad1s1f   858367   783550 614899%/usr
10:04:gonzo 4# tunefs -p /usr
tunefs: cannot work on read-write mounted file system
10:04:gonzo 5# tunefs -p /dev/ad1s1f
tunefs: cannot open /dev/ad1s1f: Device busy
10:04:gonzo 6# tunefs -p /dev/rad1s1f
tunefs: cannot open /dev/rad1s1f: Device busy


3.4-STABLE:

10:05:walton 1# df /usr
Filesystem   1024-blocks UsedAvail Capacity  Mounted on
/dev/da0s1f   762223   6732362801096%/usr
10:05:walton 2# tunefs -p /usr
tunefs: cannot work on read-write mounted file system
10:05:walton 3# tunefs -p /dev/rda0s1f
tunefs: soft updates:  (-n)disabled
tunefs: maximum contiguous block count: (-a)   15
tunefs: rotational delay between contiguous blocks: (-d)   0 ms
tunefs: maximum blocks per file in a cylinder group: (-e)  2048
tunefs: minimum percentage of free space: (-m) 8%
tunefs: optimization preference: (-o)  time




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: tunefs -p doesn't work for read-write mounts

2000-03-03 Thread Peter Edwards

I just send-pr'ed a patch for this: misc/17143

David Malone wrote:
 
 On Fri, Mar 03, 2000 at 11:23:33AM +0200, Sheldon Hearn wrote:
 
  Shouldn't I be able to show the current tuneables for a given filesystem?
 
  # tunefs -p /usr
  tunefs: cannot work on read-write mounted file system
 
 Tunefs seems to have had trouble with being given filesystem names
 for a bit. Giving the device name works in 3.4, but not in 4.0.
 
 David.
 
 4.0-CURRENT:
 
 10:04:gonzo 3# df /usr
 Filesystem   1024-blocks UsedAvail Capacity  Mounted on
 /dev/ad1s1f   858367   783550 614899%/usr
 10:04:gonzo 4# tunefs -p /usr
 tunefs: cannot work on read-write mounted file system
 10:04:gonzo 5# tunefs -p /dev/ad1s1f
 tunefs: cannot open /dev/ad1s1f: Device busy
 10:04:gonzo 6# tunefs -p /dev/rad1s1f
 tunefs: cannot open /dev/rad1s1f: Device busy
 
 3.4-STABLE:
 
 10:05:walton 1# df /usr
 Filesystem   1024-blocks UsedAvail Capacity  Mounted on
 /dev/da0s1f   762223   6732362801096%/usr
 10:05:walton 2# tunefs -p /usr
 tunefs: cannot work on read-write mounted file system
 10:05:walton 3# tunefs -p /dev/rda0s1f
 tunefs: soft updates:  (-n)disabled
 tunefs: maximum contiguous block count: (-a)   15
 tunefs: rotational delay between contiguous blocks: (-d)   0 ms
 tunefs: maximum blocks per file in a cylinder group: (-e)  2048
 tunefs: minimum percentage of free space: (-m) 8%
 tunefs: optimization preference: (-o)  time
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with "unsubscribe freebsd-current" in the body of the message


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: tunefs -p doesn't work for read-write mounts

2000-03-03 Thread Devin Butterfield

Sheldon Hearn wrote:
 
 Hi folks,
 
 Shouldn't I be able to show the current tuneables for a given filesystem?
 
 # tunefs -p /usr
 tunefs: cannot work on read-write mounted file system
 
 This is on a recent CURRENT.

AFAIK, you always need to do this with unmounted file systems. Unless of
course this was fixed in current?


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: tunefs -p doesn't work for read-write mounts

2000-03-03 Thread Jeffrey J. Mountin

At 03:14 AM 3/3/00 -0800, Devin Butterfield wrote:
Sheldon Hearn wrote:
 
 Hi folks,
 
 Shouldn't I be able to show the current tuneables for a given filesystem?
 
 # tunefs -p /usr
 tunefs: cannot work on read-write mounted file system
 
 This is on a recent CURRENT.

AFAIK, you always need to do this with unmounted file systems. Unless of
course this was fixed in current?

Why so to only view the values?


Jeff Mountin - [EMAIL PROTECTED]
Systems/Network Administrator
FreeBSD - the power to serve



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: tunefs -p doesn't work for read-write mounts

2000-03-03 Thread Luoqi Chen

 Hi folks,
 
 Shouldn't I be able to show the current tuneables for a given filesystem?
 
 # tunefs -p /usr
 tunefs: cannot work on read-write mounted file system
 
 This is on a recent CURRENT.
 
 Ciao,
 Sheldon.
 
You were supposed to use a raw device for a mounted fs, but that no longer
works after the elimination of block device. I have a quick fix for this
problem: open the device read-only to read the superblock and later re-open
it read-write before writing back.

-lq

Index: tunefs.c
===
RCS file: /home/ncvs/src/sbin/tunefs/tunefs.c,v
retrieving revision 1.11
diff -u -r1.11 tunefs.c
--- tunefs.c2000/01/30 05:24:55 1.11
+++ tunefs.c2000/03/03 16:04:04
@@ -75,9 +75,10 @@
 int fi;
 long dev_bsize = 1;
 
-void bwrite(daddr_t, char *, int);
-int bread(daddr_t, char *, int);
-void getsb(struct fs *, char *);
+void bwrite __P((daddr_t, char *, int));
+int bread __P((daddr_t, char *, int));
+void getsb __P((struct fs *, char *));
+void putsb __P((struct fs *, char *, int));
 void usage __P((void));
 void printfs __P((void));
 
@@ -103,9 +104,6 @@
if (fs) {
if (statfs(special, stfs) == 0 
strcmp(special, stfs.f_mntonname) == 0) {
-   if ((stfs.f_flags  MNT_RDONLY) == 0) {
-   errx(1, "cannot work on read-write mounted file 
system");
-   }
active = 1;
}
special = fs-fs_spec;
@@ -251,12 +249,7 @@
}
if (argc != 1)
usage();
-   bwrite((daddr_t)SBOFF / dev_bsize, (char *)sblock, SBSIZE);
-   if (Aflag)
-   for (i = 0; i  sblock.fs_ncg; i++)
-   bwrite(fsbtodb(sblock, cgsblock(sblock, i)),
-   (char *)sblock, SBSIZE);
-   close(fi);
+   putsb(sblock, special, Aflag);
if (active) {
bzero(args, sizeof(args));
if (mount("ufs", fs-fs_file,
@@ -283,7 +276,7 @@
char *file;
 {
 
-   fi = open(file, 2);
+   fi = open(file, 0);
if (fi  0)
err(3, "cannot open %s", file);
if (bread((daddr_t)SBOFF, (char *)fs, SBSIZE))
@@ -291,6 +284,30 @@
if (fs-fs_magic != FS_MAGIC)
err(5, "%s: bad magic number", file);
dev_bsize = fs-fs_fsize / fsbtodb(fs, 1);
+}
+
+void
+putsb(fs, file, all)
+   register struct fs *fs;
+   char *file;
+   int all;
+{
+   int i;
+
+   /*
+* Re-open the device read-write. Use the read-only file
+* descriptor as an interlock to prevent the device from
+* being mounted while we are switching mode.
+*/
+   i = fi; fi = open(file, 2); close(i);
+   if (fi  0)
+   err(3, "cannot open %s", file);
+   bwrite((daddr_t)SBOFF / dev_bsize, (char *)fs, SBSIZE);
+   if (all)
+   for (i = 0; i  fs-fs_ncg; i++)
+   bwrite(fsbtodb(fs, cgsblock(fs, i)),
+   (char *)fs, SBSIZE);
+   close(fi);
 }
 
 void


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message