Since auto_64-bit_support is on by default, resize_inode feature will
be disabled when creating a >16T ext4 according to mke2fs.conf(5).
This should also be done when making ext4 with "-O 64bit" to enable
64bit feature explicitly. Otherwise online resize to enlarge a
over-16T fs to larger would fail.
[root@localhost resize]# truncate -s 50t fs.img
[root@localhost resize]# losetup /dev/loop0 fs.img
[root@localhost resize]# mkfs -t ext4 -O 64bit /dev/loop0 30t
[root@localhost resize]# mount /dev/loop0 mnt
[root@localhost resize]# resize2fs /dev/loop0
resize2fs 1.42.7 (21-Jan-2013)
Filesystem at /dev/loop0 is mounted on /root/resize/mnt; on-line resizing required
old_desc_blocks = 3840, new_desc_blocks = 6400
resize2fs: Invalid argument While checking for on-line resizing support
And dmesg shows
[688378.442623] EXT4-fs (loop0): resizing filesystem from 6710886400 to 13421772800 blocks
[688378.443216] EXT4-fs warning (device loop0): verify_reserved_gdb:700: reserved GDT 3201 missing grp 177147 (5804756097)
[688378.443222] EXT4-fs (loop0): resized filesystem to 8858370048
[688378.528451] EXT4-fs warning (device loop0): ext4_group_extend:1710: can't shrink FS - resize aborted
With this fix resize2fs could do the online enlarge correctly.
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Now inline_data doesn't depend on ext_attr. Hence we don't need to do
this sanity check. But if the inode size is too small (128 bytes),
inline_data will be useless because we couldn't save data in ibody
extented attribute. So we need to report this error.
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Refactor the running kernel version checks to hide the details of
version code checking, etc.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Add the extended options packed_meta_blocks and journal_location_front
which causes mke2fs to place the metadata blocks at the beginning of
the file system.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
In practice, it is **extremely** rare for users to try to use more
than the first backup superblock located at the beginning of block
group #1. (i.e., at block number 32768 for file systems with a 4k
block size). This new compat feature restricts the backup superblock
to block group #1 and the last block group in the file system.
Aside from reducing the overhead of the file system by a small number
of blocks, by eliminating the rest of the backup superblocks, it
allows us to have a much more flexible metadata layout. For example,
we can force all of the allocation bitmaps and inode table blocks to
the beginning of the disk, which allows most of the disk to be
exclusively used for contiguous data blocks.
This simplifies taking advantage of certain HDD specific features,
such as Shingled Magnetic Recording (aka Shingled Drives), and the
TCG's OPAL Storage Specification where having a simple mapping between
LBA block ranges and the data blocks used by the file system can make
life much simpler.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Instead of iterating over the allocation bitmap using
ext2fs_test_block_bitmap2(), bit by bit, use
ext2fs_find_first_set_block_bitmap2() instead.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
The s_desc_size in the superblock specifies the group descriptor
size in bytes, but in various places the EXT4_FEATURE_INCOMPAT_64BIT
flag implies that the descriptor size is EXT2_MIN_DESC_SIZE_64BIT
(64 bytes) instead of checking the actual size. In other places,
the s_desc_size field is used without checking for INCOMPAT_64BIT.
In the case of ext2fs_group_desc() the s_desc_size was being ignored,
and assumed to be sizeof(struct ext4_group_desc), which would result
in garbage for any but the first group descriptor. Similarly, in
ext2fs_group_desc_csum() and print_csum() they assumed that the
maximum group descriptor size was sizeof(struct ext4_group_desc).
Fix these functions to use the actual superblock s_desc_size if
INCOMPAT_64BIT.
Conversely, in ext2fs_swap_group_desc2() s_desc_size was used
without checking for INCOMPAT_64BIT being set.
The e2fsprogs behaviour is different than that of the kernel,
which always checks INCOMPAT_64BIT, and only uses s_desc_size to
determine the offset of group descriptors and what range of bytes
to checksum.
Allow specifying the s_desc_size field at mke2fs time with the
"-E desc_size=NNN" option. Allow a power-of-two s_desc_size
value up to s_blocksize if INCOMPAT_64BIT is specified. This
is not expected to be used by regular users at this time, so it
is not currently documented in the mke2fs usage or man page.
Add m_desc_size_128, f_desc_size_128, and f_desc_bad test cases to
verify mke2fs and e2fsck handling of larger group descriptor sizes.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Mostly by adding static and removing excess extern qualifiers. Also
convert a few remaining non-ANSI function declarations to ANSI.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Compiling with LLVM generates a large number of warnings due
to the use of _() for wrapping strings for i18n:
warning: format string is not a string literal
(potentially insecure) [-Wformat-security]
./nls-enable.h:4:14: note: expanded from macro '_'
#define _(a) (gettext (a))
^~~~~~~~~~~~
These warnings are fixed by using "%s" as the format string,
and then _() is used as the string argument.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
mke2fs has a series of checks to ensure that we don't create a
filesystem too big for its blocksize -- if auto-64bit is on, then it
turns on 64bit; otherwise it complains. Unfortunately, it performs
these checks before looking in mke2fs.conf for a blocksize, which
means that the checks are incorrect if the user specifies a non-4096
blocksize in the config file and says nothing on the command line.
The bug also has the effect of mandating a 4k block size on any block
device larger than 4T in that situation. Therefore, read the block
size from the config file before performing the 64bit checks.
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Passing the "-E resize=NNN" option to mke2fs sets the resize_inode
feature. However, resize_inode and meta_bg are mutually exclusive;
unfortunately, we check this constraint before we parse the extended
options. Fix this by moving this check after the calls
parse_extended_opts().
Reported-by: "Darrick J. Wong" <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
A 64bit filesystem without extents is not terribly useful, because the
old block map format does not support pointing to high block numbers.
Warn the user who tries to create such an animal.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
We can calculate journal blocks as soon as blocksize is set.
It will help to figure out wrong journal blocks count earlier.
This will save some un-necessary initialization.
Without patch output =>
mke2fs /dev/sdc1 -J size=1048576
mke2fs 1.42.7 (21-Jan-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
61312 inodes, 244936 blocks
12246 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=251658240
8 block groups
32768 blocks per group, 32768 fragments per group
7664 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
The requested journal size is 268435456 blocks; it must be
between 1024 and 10240000 blocks. Aborting.
With patch output =>
mke2fs /dev/sdc1 -J size=1048576
mke2fs 1.42.7 (21-Jan-2013)
The requested journal size is 268435456 blocks; it must be
between 1024 and 10240000 blocks. Aborting.
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Don't change the root directory's UID/GID automatically just because
mke2fs was run as a non-root user. This can be confusing for users,
and is not flexible for non-root installation tools that need to
create a filesystem with different ownership from the current user.
Add the "-E root_owner[=uid:gid]" option to mke2fs so that the user
and group can be explicitly specified for the root directory. If
the "=uid:gid" argument is not specified, the current UID and GID
are extracted from the running process, as was done in the past.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
A minor cleanup to order the command-line option parsing in
alphabetical order, except for "-E" and "-R", which need to
be co-located.
Print a message that the "-R" option is deprecated. It has
been deprecated since 2005 (commit c6a44136b9).
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The -b and -C options now use parse_num_blocks2() instead of strtol,
so that users can specify -C 256M instead of the much less convenient
-C 268435456.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
If bigalloc is enabled, then -g will specify the clusters per block
group. (If bigalloc is not enabled, then a cluster == a block, so the
meaning of -g is not changed.)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
In addition, do not allow a cluster size of 1024, since that will be
interpreted by ext2fs_initialize() as requesting the default cluster
size.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Reported-by: Zheng Liu <wenqing.lz@taobao.com>
When cluster-size is specified without the bigalloc feature, mke2fs
will ignore this argument silently. But user might think bigalloc
feature has been enabled unless they use the dumpe2fs command. So now
we ask user to set bigalloc feature explicity when cluster-size is
enabled. This can make sure that users understand what they are doing
because bigalloc might impact the performance for some workloads.
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
When bigalloc feature is enabled in mkfs, extents feature also needs
to be enabled. But now when bigalloc feature is enabled without
extents feature, users will not get any warning messages until they
try to mount this file system.
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
If the 64-bit file system feature is enabled, then mke2fs would crash
due to a divide-by-zero error caused by s_desc_size not being
initialized yet.
Reported-by: George Spelvin <linux@horizon.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
There are certain file system features which can not be supported by
the HURD, since they use fields in the inode which have been claimed
by HURD-specific features (i.e., such as the author field). We will
mask out those features so they are not enabled by accident, but if the
user tries to explicitly specify them we will issue an error message.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Throttle updates for the "Allocating Groups" progress updates to once
a second as well. We now do this throttling in libext2fs, so we don't
have to do this for each of mke2fs's progress updates, and because the
updates from ext2fs_allocate_tables() come from within libext2fs
anyway.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Add a configuration knob so the regression tests can disable progress
reporting. This fixes a potential lack of predictability since the
progress reports are now time based (once a second) which is
problematic for regression tests which are comparing the expected
output of mke2fs.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
With lazy itable initialization, the progress updates for writing the
inode table happens so quickly that on a serial console, the time to
write the progress updates can be the bottleneck. Fix this by only
updating the progress indicator once a second.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
The metadata_csum feature works best when two features are enabled.
These features are "extents" (because the block map has no space for
checksums) and "64bit" (this enables storage of full 32-bit checksums
in certain fields). Print a warning if the user tries to create a
filesystem without those features.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Update mke2fs to use the helper function to determine if group
descriptors should have checksums calculated. Since metadata_csum
supersedes uninit_bg, quietly drop uninit_bg if metadata_csum is set,
so that older kernels don't get confused.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Record the type of checksum algorithm we're using for metadata in the
superblock when creating a filesystem.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Write out reserved inodes with full checksums when writing out a
zeroed table.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Precompute the FS UUID checksum seed that is used for all metadata
checksumming operations and store it in ext2_filsys.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Instead of calling ext2fs_numeric_progress_*() directly from closefs.c
and alloc_tables.c, call it via a operations structure which is only
initialized by the one program (mke2fs) which needs it.
This reduces the number of C library symbols needed by boot loader
systems such as yaboot.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Change autoconf to test for setmntent() and use that to decide whether
to use getmntent() and setmntent(), since some systems don't have
setmntent() but they do have the mntent.h header file.
Also, remove the includes of mntent.h from e2fsck and mke2fs and other
places where it is not needed.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
The ext2fs_add_journal_inode() function calls
ext2fs_check_mount_point(), which can fail if /etc/mtab is missing.
This causes mke2fs to fail in the middle of the file system format
process; mke2fs calls ext2fs_check_mount_point() already (and has
appropriate fallbacks that calls fails), so add a flag so that mke2fs
can request ext2fs_add_journal_inode() to skip trying to call
e2fsck_check_mount_point().
Addresses-Sourceforge-Bug: #3509398
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This can be useful when using mke2fs on loaded servers, since
otherwise mke2fs can dirty a huge amount of memory very quickly,
leading to other applications not being happy at all.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
There was a bug/typo in commit ba9e0afc5 which caused the first block
group (bg #0) to not have its unused inode count field to get set to
zero in the case of mke2fs -S. This caused inodes in the first block
group to not be recoverable via mke2fs -S. Oops.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
The command mke2fs -S is used as a last ditch recovery command to
write new superblock and block group descriptors, but _not_ to destroy
the inode table in hopes of recovering from a badly corrupted file
system. If the uninit_bg feature is enabled, we need to make sure to
clear the unused inodes count field in the block group descriptors or
else e2fsck -fy will leave the file system completely empty.
Thanks to Akira Fujita for reporting this problem.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
We shipped "mke4fs" alongside mke2fs in RHEL5, so that ext4-capable
utilities could be installed without disturbing the venerable e2fsprogs-1.39
shipped in RHEL5 from the beginning. But it surprised some users that
"mke4fs" created ext2 filesystems by default rather than ext4.
While it was my intent to have the renamed binaries behave exactly
like the stock ones, it seems that there is some precedence for
handling "mkeNfs" in the code, so seems reasonable to add
mke4fs -> ext4 as well.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The option '-G' is used to pass number of groups in a flex_bg, the
previous help text - 'meta-group-size' - could confuse users with
meta_bg.
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
There is a slight desync between the mke2fs(8) man page and the mke2fs
help output when it comes to the -t/-T options. Since the man page is
correct, update the mke2fs usage string to match.
Reported-by: Ben Kohler <bkohler@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
mke2fs was creating both user and group quota inodes on enabling
the quota feature. This patch adds the extended option 'quotatype'
that can be used to exclusively specify the quota type that the
user wants to initialize.
# Ex: Default behavior without extended option creates both
# user and group quota inodes:
$ mke2fs -t ext4 -O quota /dev/ram1
# To enable only user quotas:
$ mke2fs -t ext4 -O quota -E quotatype=usr /dev/ram1
# To enable only group quotas:
$ mke2fs -t ext4 -O quota -E quotatype=grp /dev/ram1
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This patch cleans up the quota code as suggested in previous reviews. This
includes
* remove BUG_ON()s and 'exit()' calls from library code
* remove calls to malloc/free and instead use ext2fs_get/free_mem functions.
* lib/quota/common.c file in not needed anymore and is removed.
* rename exported functions to start with quota_
(ex: init_quota_context --> quota_init_context)
* better error handling in quota library
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Quota support can be enabled using --enable-quota. There are still
some buglets that we need to fix up before it can be considered 100%
supported, so let's disable it for the 1.42 release.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Also remove the _("<foo>") marker from a string that was all numbers
and hence didn't need punctuation.
Thanks to Philipp Thomas and Goeran Uddeborg for reporting these
buglets.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Commit c6ed60cd removed "f" (fragment size) from the getopt string,
and re-used its spot in the getopt switch, but didn't update the
usage message or the error message during parsing.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
For those e2fsprogs programs which use libcom_err and are
internationalized, pass the gettext() function to libcom_err during
program initialization.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
If the enable_periodic_fsck option is false in /etc/mke2fs.conf (which
is also the default), s_max_mnt_count needs to be set to -1, instead
of 0. Kernels newer than 3.0 will interpret 0 to disable periodic
checks, but older kernels will print a warning message on each mount,
which will annoy users.
Addresses-Debian-Bug: #632637
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Multi-mount protection is feature that allows mke2fs, e2fsck, and
others to detect if the filesystem is mounted on a remote node (on
SAN disks) and avoid corrupting the filesystem. For e2fsprogs this
means that it checks the MMP block to see if the filesystem is in use,
and marks the filesystem busy while e2fsck is running on the system.
This is useful on SAN disks that are shared between high-availability
servers, or accessible by multiple nodes that aren't in HA pairs. MMP
isn't intended to serve as a primary HA exclusion mechanism, but as a
failsafe to protect against user, software, or hardware errors.
There is no requirement that e2fsck updates the MMP block at regular
intervals, but e2fsck does this occasionally to provide useful
information to the sysadmin in case of a detected conflict.
For the kernel (since Linux 3.0) MMP adds a "heartbeat" mechanism to
periodically write to disk (every few seconds by default) to notify
other nodes that the filesystem is still in use and unsafe to modify.
Originally-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Johann Lombardi <johann@whamcloud.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and
this was starting to cause some tools heartburn. It also made "make
V=1" almost useless, since trying to following the individual commands
run by make was lost in the noise of all of the defines.
So fix this by putting the configure-generated defines in lib/config.h
and the directory pathnames to lib/dirpaths.h.
In addition, clean up some vestigal defines in configure.in and in the
Makefiles to further shorten the cc command lines.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
if tdb_dir points to a string allocated from profile_get_string,
it should be freed again before we exit.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
In addition to not making sense, it causes a memory leak
when fs_type gets overwritten.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
parse_fs_type explicitly sets usage_types if it is null,
so there is no need to test for null later.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
If e2fsprogs tools (mke2fs, e2fsck) is run on regular file instead of
on block device, we can use punch hole instead of regular discard
command which would not work on regular file anyway. This gives us
several advantages. First of all when e2fsck is run with '-E discard'
parameter it will punch out all ununsed space from the image, hence
trimming down the file system image. And secondly, when creating an
file system on regular file (with '-E discard' which is default), we
can use punch hole to clear the file content, hence we can skip inode
table initialization, because reads from sparse area returns zeros. This
will result in faster file system creation (without the need to specify
lazy_itable_init) and smaller images.
This commit also fixes some tests that would fail due to mke2fs showing
discard progress, hence the output would differ.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Block size can be specified manually via the -b option or deduced
automatically. Unfortunately, the check that it is still smaller than
the system page size is only performed right after the command line
options are parsed.
Therefore, if buggy or inappropriately installed/configured hardware
hints that larger block sizes have to be used, mkfs will silently create
a file system which can not be mounted on the system in question.
By moving the check beyond the last assignment to blocksize it is now
ensured, that mkfs will issue a warning even if inappropriate blocksize
was auto-detected.
The new behavior can be easily tested, by exporting the following
variables before running mkfs:
export MKE2FS_DEVICE_SECTSIZE=8192
export MKE2FS_DEVICE_PHYS_SECTSIZE=8192
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
We are doing ext2fs_flush() twice right now at the end of the mke2fs.
First by directly calling ext2fs_flush() which is intended to write
superblock and fs accounting information. And then it is invoked again
when we are calling ext2fs_close(), only this time, because the fs is
not dirty, we are writing out only superblock.
I think it is bad to call it twice because even when writing only super
block it takes some time on bigger file systems and moreover
ext2fs_close() can fail without any reasonable explanation for the user.
Also ext2fs_flush() is printing out progress and it is confusing for the
users.
Fix all this by removing the ext2fs_flush() and leaving it all to
ext2fs_close(). However we need to introduce new variables to store
check interval and max mount count, because fs structure is freed on
ext2fs_close() and we really want to print those information as the last
info for the user.
[ Fixed type mismatch in a printf format statement -tytso]
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
mke2fs also creates quota inodes (userquota: inode# 3 and
groupquota: inode #4) inodes while creating a filesystem when 'quota'
feature is set.
# To set quota feature and initialize quota inodes during mke2fs:
$mke2fs -t ext4 -O quota /dev/ram1
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Mke2fs previously would give an error if the user tried setting the
stride and stripe-width parameters to zero; but this is necessary to
override the stride and stripe-width settings which get automatically
set from the block device's geometry information in sysfs. So allow
setting these parameters to zero.
Addresses-Google-Bug: #4988555
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Treat the s_blocks_count field in the superblock as a free block count
(instead of the number of free clusters) for bigalloc file systems.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Add the ability to skip zeroing journal blocks on disk. This can
significantly speed up mke2fs with large journals. At worst the
uninitialized journal is only a very short-term risk (if at all),
because the journal will be overwritten on any new filesystem as
soon as any significant amount of data is written to disk, and
the new journal TID would need to match the offset/TID of an old
commit block still left on disk.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
If "mke2fs -n" is used, there should be no changes to the underlying
device. Unfortunately, when the "discard" option was added in commit
c7cd908be5, it did not check for the "-n"
flag, and will discard all data on a flash device even if "-n" is given.
Check for the "noaction" flag before discarding any filesystem data.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The log2 of the ratio of cluster size to block size is far more useful
than just storing the cluster size. So make this change, and then
define basic utility macros: EXT2FS_CLUSTER_RATIO(),
EXT2FS_CLUSTER_MASK(), EXT2FS_B2C(), EXT2FS_C2B(), and
EXT2FS_NUM_B2C().
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>