diff options
author | trasz <trasz@FreeBSD.org> | 2012-10-30 21:32:10 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2012-10-30 21:32:10 +0000 |
commit | ff5b37a93e45dfa350cd924478c25f32e87f922a (patch) | |
tree | 2c00e9d729a9009b78e4f58c7aab66de552d87a6 /sbin/newfs | |
parent | 335b7a9f3cabbf193a9059af1bcc6c52bbe672af (diff) | |
download | FreeBSD-src-ff5b37a93e45dfa350cd924478c25f32e87f922a.zip FreeBSD-src-ff5b37a93e45dfa350cd924478c25f32e87f922a.tar.gz |
Fix problem with geom_label(4) not recognizing UFS labels on filesystems
extended using growfs(8). The problem here is that geom_label checks if
the filesystem size recorded in UFS superblock is equal to the provider
(i.e. device) size. This check cannot be removed due to backward
compatibility. On the other hand, in most cases growfs(8) cannot set
fs_size in the superblock to match the provider size, because, differently
from newfs(8), it cannot recompute cylinder group sizes.
To fix this problem, add another superblock field, fs_providersize, used
only for this purpose. The geom_label(4) will attach if either fs_size
(filesystem created with newfs(8)) or fs_providersize (filesystem expanded
using growfs(8)) matches the device size.
PR: kern/165962
Reviewed by: mckusick
Sponsored by: FreeBSD Foundation
Diffstat (limited to 'sbin/newfs')
-rw-r--r-- | sbin/newfs/mkfs.c | 1 | ||||
-rw-r--r-- | sbin/newfs/newfs.c | 2 | ||||
-rw-r--r-- | sbin/newfs/newfs.h | 1 |
3 files changed, 3 insertions, 1 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index efc22c3..0a547f9 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -263,6 +263,7 @@ restart: } sblock.fs_fsbtodb = ilog2(sblock.fs_fsize / sectorsize); sblock.fs_size = fssize = dbtofsb(&sblock, fssize); + sblock.fs_providersize = dbtofsb(&sblock, mediasize / sectorsize); /* * Before the filesystem is finally initialized, mark it diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 6163774..3ce0be7 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -94,6 +94,7 @@ int lflag; /* enable multilabel for file system */ int nflag; /* do not create .snap directory */ int tflag; /* enable TRIM */ intmax_t fssize; /* file system size */ +off_t mediasize; /* device size */ int sectorsize; /* bytes/sector */ int realsectorsize; /* bytes/sector in hardware */ int fsize = 0; /* fragment size */ @@ -135,7 +136,6 @@ main(int argc, char *argv[]) char *cp, *special; intmax_t reserved; int ch, i, rval; - off_t mediasize; char part_name; /* partition name, default to full disk */ part_name = 'c'; diff --git a/sbin/newfs/newfs.h b/sbin/newfs/newfs.h index 25bfcc8..9e1da0d 100644 --- a/sbin/newfs/newfs.h +++ b/sbin/newfs/newfs.h @@ -88,6 +88,7 @@ extern int lflag; /* enable multilabel MAC for file system */ extern int nflag; /* do not create .snap directory */ extern int tflag; /* enable TRIM */ extern intmax_t fssize; /* file system size */ +extern off_t mediasize; /* device size */ extern int sectorsize; /* bytes/sector */ extern int realsectorsize; /* bytes/sector in hardware*/ extern int fsize; /* fragment size */ |