Subject: Re: newfs can't make filesystems over 1TB in size
To: Brian Buhrow <buhrow@lothlorien.nfbcal.org>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: current-users
Date: 12/07/2002 14:23:11
--ELM737034890-9200-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
Brian Buhrow wrote:
> Hello Jaromir. According to the document you reference, the fragment
> size must only be 2K to create a 4TB filesystem. The filesystem I'm trying
> to create has a fragment size of 4K, and a block size of 16K. The problem
> seems to be in newfs itself. The variable llsize is taken to be the size
> of the filesystem, and llsize is a long long. However, the filesystem size
> is passed to mkfs() inside fssize, which is a signed 32-bit integer. I
> think here-in lies the problem.
Can you try if appended patch makes any difference? (Not tested)
Done against -current newfs.
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/
-=- We should be mindful of the potential goal, but as the tantric -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow. Do not let this distract you.'' -=-
--ELM737034890-9200-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=ISO-8859-2
Content-Disposition: attachment; filename=newfs2t.diff
? .mkfs.c.swp
? newfs2t.diff
Index: extern.h
===================================================================
RCS file: /cvsroot/basesrc/sbin/newfs/extern.h,v
retrieving revision 1.8
diff -u -p -r1.8 extern.h
--- extern.h 2002/09/28 20:11:07 1.8
+++ extern.h 2002/12/07 13:23:01
@@ -36,7 +36,7 @@ void mkfs(struct partition *, const char
extern int mfs; /* run as the memory based filesystem */
extern int Nflag; /* run mkfs without writing file system */
extern int Oflag; /* format as an 4.3BSD file system */
-extern int fssize; /* file system size */
+extern int64_t fssize; /* file system size */
extern int ntracks; /* # tracks/cylinder */
extern int nsectors; /* # sectors/track */
extern int nphyssectors; /* # sectors/track including spares */
Index: mkfs.c
===================================================================
RCS file: /cvsroot/basesrc/sbin/newfs/mkfs.c,v
retrieving revision 1.65
diff -u -p -r1.65 mkfs.c
--- mkfs.c 2002/09/28 20:11:07 1.65
+++ mkfs.c 2002/12/07 13:23:01
@@ -160,8 +160,10 @@ mkfs(struct partition *pp, const char *f
* Validate the given file system size.
* Verify that its last block can actually be accessed.
*/
- if (fssize <= 0)
- printf("preposterous size %d\n", fssize), exit(13);
+ if (fssize <= 0) {
+ printf("preposterous size %lld\n", (long long) fssize);
+ exit(13);
+ }
wtfs(fssize - 1, sectorsize, (char *)&sblock);
if (isappleufs) {
@@ -542,8 +544,8 @@ next:
warning = 0;
}
if (warning && !mfs) {
- printf("Warning: %d sector(s) in last cylinder unallocated\n",
- sblock.fs_spc -
+ printf("Warning: %lld sector(s) in last cylinder unallocated\n",
+ (long long) sblock.fs_spc -
(fssize * NSPF(&sblock) - (sblock.fs_ncyl - 1)
* sblock.fs_spc));
}
Index: newfs.c
===================================================================
RCS file: /cvsroot/basesrc/sbin/newfs/newfs.c,v
retrieving revision 1.61
diff -u -p -r1.61 newfs.c
--- newfs.c 2002/09/28 20:11:07 1.61
+++ newfs.c 2002/12/07 13:23:01
@@ -172,7 +172,7 @@ int main(int, char *[]);
int mfs; /* run as the memory based filesystem */
int Nflag; /* run without writing file system */
int Oflag; /* format as an 4.3BSD file system */
-int fssize; /* file system size */
+int64_t fssize; /* file system size */
int ntracks; /* # tracks/cylinder */
int nsectors; /* # sectors/track */
int nphyssectors; /* # sectors/track including spares */
@@ -467,9 +467,9 @@ main(int argc, char *argv[])
if ((fsi = dup(fso)) == -1)
err(1, "can't dup(2) image fd");
/* XXXLUKEM: only ftruncate() regular files ? */
- if (ftruncate(fso, (off_t)fssize * sectorsize) == -1)
- err(1, "can't resize %s to %d",
- special, fssize);
+ if (ftruncate(fso, fssize * sectorsize) == -1)
+ err(1, "can't resize %s to %llu",
+ special, (unsigned long long) fssize);
if (Zflag) { /* pre-zero the file */
char *buf;
--ELM737034890-9200-0_--