Commit Graph

18 Commits

Author SHA1 Message Date
Maxim Sobolev
55f9588af4 Relax checking if the privider size matches size recorded in the
superblock, allowing provider to be bit bigger, i.e. have some
extra padding after the FS image. That in some cases might be
a side-effect of using CLOOP format which enforces certain block
size and trying to compress image that is not exactly the number
of those blocks in size. The UFS itself does not have any issues
mounting such padded file systems, so it's what GEOM_LABEL should
do.

Submitted by:	@mizhka_gmail.com
Differential Revision:	https://reviews.freebsd.org/D6208
2016-07-18 05:00:01 +00:00
Edward Tomasz Napierala
c7c7d7d0f0 Make r242379 - the fix for UFS labels disappearing after resizing
the provider - also apply to UFS1 filesystems.  This should help with
resizing filesystems created by makefs(8), which still uses UFS1.

Tested by:	jmg@
Sponsored by:	The FreeBSD Foundation
2014-05-05 09:20:30 +00:00
Edward Tomasz Napierala
549f62fa42 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
2012-10-30 21:32:10 +00:00
Edward Tomasz Napierala
d87e55886e Revert r235918 for now and add comment explaining the reason for the
size check.
2012-05-25 10:08:48 +00:00
Edward Tomasz Napierala
202f0f2a02 Make g_label(4) ignore provider size when looking for UFS labels.
Without it, it fails to create labels for filesystems resized by
growfs(8).

PR:		kern/165962
Submitted by:	Olivier Cochard-Labbe <olivier at cochard dot me>
2012-05-24 16:48:33 +00:00
Edward Tomasz Napierala
3ce9ca8947 Provide a set of sysctls and tunables to disable device node creation
for specific "kinds" of disk labels - for example, GPT UUIDs.  Reason
for this is that sometimes, other GEOM classes attach to these device
nodes instead of the proper ones - e.g. they attach to /dev/gptid/XXX
instead of /dev/ada0p2, which is annoying.

Reviewed by:	pjd (earlier version)
MFC after:	1 month
2009-11-28 11:57:43 +00:00
Ivan Voras
f7b16839ba Create GEOM labels from UFS IDs, e.g. /dev/ufsid/49c97b1faa2adc43. UFS IDs
are always present and can be used to identify file systems (useful if
hardware devices move often).

Actually-by:	pjd
Approved by:	gnn (mentor)
2009-03-25 20:38:57 +00:00
Pawel Jakub Dawidek
f8aa16c66c Fix detecting of UFS1 label when mediasize%fragsize != 0.
Submitted by:	Stanislav Sedov
PR:		kern/84637
MFC after:	1 week
2006-09-16 11:24:41 +00:00
Pawel Jakub Dawidek
99c889fc7d We need to check if file system size is equal to provider's size, because
sysinstall(8) still bogusly puts first partition at offset 0 instead of 16,
so glabel/ufs will find file system on slice instead of partition.

Before sysinstall is fixed, we must keep this code, which means that we
wont't be able to detect UFS file systems created with 'newfs -s ...'.

PS. bsdlabel(8) creates partitions properly.

MFC after:	3 days
2006-03-04 19:41:54 +00:00
Pawel Jakub Dawidek
c058f51257 - Do not depend on fact that file system covers entire provider.
It won't work for file systems created with -s option.
  Use better file system verfication.
- Add myself to the copyright.

MFC after:	3 days
2006-02-18 10:59:47 +00:00
Pawel Jakub Dawidek
17fb8ae78f This function returns nothing. 2006-02-18 03:04:26 +00:00
Pawel Jakub Dawidek
33361bb5db If provider's sector size prevents reading SBLOCKSIZE bytes return
immediatelly.
2006-02-18 03:00:49 +00:00
Pawel Jakub Dawidek
38ea96ac99 Remove trailing spaces. 2006-02-01 12:06:01 +00:00
Maxim Sobolev
b53a1cf306 Don't pass error value pointer to g_read_data(9) at all if we don't
have any use of it.

Suggested by:	pjd
2005-11-30 22:15:00 +00:00
Maxim Sobolev
8a4a44b5aa Check for g_read_data(9) errors properly:
o The only indication of error condition is NULL value returned by
  the function;

o value pointed to by error argument is undefined in the case when
  operation completes successfully.

Discussed with: phk
2005-11-30 19:24:51 +00:00
Garrett Wollman
d5e3d722df The size of a filesystem may be less than the size of the provider it
resides on.  Fix the special case of the filesystem fragment size not
evenly dividing the size of the provider.  Fixing the general case
probably requires better superblock validation (left as an exercise to
the reader).
2005-04-19 21:55:28 +00:00
Dag-Erling Smørgrav
04550802d8 merge from geom_vol_ffs.c rev 1.14 (avoid unaligned I/O requests) 2005-02-08 12:34:11 +00:00
Pawel Jakub Dawidek
e1237b285b Introduce GEOM_LABEL class.
This class is used for detecting volume labels on file systems:
UFS, MSDOSFS (FAT12, FAT16, FAT32) and ISO9660.
It also provide native labelization (there is no need for file system).

g_label_ufs.c is based on geom_vol_ffs from Gordon Tetlow.
g_label_msdos.c and g_label_iso9660.c are probably hacks, I just found
where volume labels are stored and I use those offsets here,
but with this class it should be easy to do it as it should be done by
someone who know how.
Implementing volume labels detection for other file systems also should
be trivial.

New providers are created in those directories:
/dev/ufs/ (UFS1, UFS2)
/dev/msdosfs/ (FAT12, FAT16, FAT32)
/dev/iso9660/ (ISO9660)
/dev/label/ (native labels, configured with glabel(8))

Manual page cleanups and some comments inside were submitted by
Simon L. Nielsen, who was, as always, very helpful. Thanks!
2004-07-02 19:40:36 +00:00