Commit Graph

917 Commits (bf0449b1a6547a566975cb32c18a2ba5972deace)

Author SHA1 Message Date
Lukas Czerner bf0449b1a6 e2image: Add support for qcow2 format
This commit adds support for exporting filesystem into QCOW2 image
format. Like sparse format this saves space, by writing only necessary
(metadata blocks) into image. Unlike sparse image, QCOW2 image is NOT
sparse, hence does not change its size by copying with not-sparse-aware
tools.

New options '-Q' has been added to tell the e2image to use QCOW2 as an
output image format. QCOW2 supports encryption and compression, however
e2image so far does no support such features, however you can still
scramble filenames with '-s' option.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-05-18 11:51:06 -04:00
Aditya Kali d3859af33f mke2fs: Allow specifying reserved_ratio via mke2fs.conf
This patch adds support for specifying 'reserved_ratio' (percent blocks
reserved for super user, same as '-m' command line option) in mke2fs.conf.
It adds profile_get_double function in profile.c that allows reading
floating point values from profile files.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-05-14 23:34:48 -04:00
Theodore Ts'o b18c5fd51e Merge branch 'maint' into next 2011-05-07 23:24:55 -04:00
Carsten Hey 05950620a8 logsave: Update usage message so it is correct
Addresses-Debian-Bug: #619788
Signed-off-by: Carsten Hey <carsten@debian.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-05-07 21:21:42 -04:00
Eric Sandeen a8d8432b58 filefrag: count 0 extents properly when verbose
/boot/a: 0 extents found

works properly, but

Filesystem type is: ef53
Filesystem cylinder groups is approximately 61
File size of a is 0 (0 blocks, blocksize 1024)
 ext logical physical expected length flags
a: 1 extent found

yields 1 extent when it should be 0.

Fix this up by special-casing no extents returned in verbose
mode; skip printing the header for the columns too, since there
are no columns to print.

Also, in nonverbose mode we can set fm_extent_count to 0
so that FIEMAP will just query the extent count without gathering
details; clarify this with a comment.

Addresses-RedHat-Bugzilla: 653234
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-05-07 18:34:40 -04:00
Theodore Ts'o 5af9eeaa7d Merge branch 'maint' into next
Conflicts:
	lib/e2p/ls.c
2011-03-18 16:44:37 -04:00
Eric Sandeen d4a9330212 e2fsprogs: man page typo fixes
Fix a few typos in manpages.

Reported-by: Branislav Náter <bnater@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-03-18 15:03:15 -04:00
Theodore Ts'o aa07cb79b0 mke2fs: If the device supports discard, don't print an error message
Check to see if the device supports discard before starting the
progress bar, and then printing an error about inappropriate ioctl for
device (when creating a file system image to a file, for example).

Also, add a function signature in the ext2_io.h header file for
io_channel_discard() and fix an extra, uneeded argument in mke2fs's
call to that function.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-02-27 20:09:54 -05:00
Theodore Ts'o 829d999488 Merge branch 'maint' into next
Conflicts:
	lib/ext2fs/initialize.c
2011-02-27 19:47:44 -05:00
Theodore Ts'o 412376efff Add basic BIGALLOC support for cluster-based allocation
This adds the superblock fields needed so that dumpe2fs works and the
code points and renames the superblock fields from describing
fragments to clusters.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-02-25 21:43:54 -05:00
Lukas Czerner 7d9e31655f mke2fs: Display progress report during the device discard
For some time now we are doing initial discard of the device prior to
filesystem creation. However, there is no feedback for the user and
hence on some devices with slow TRIM implementation it may appear that
mke2fs is stuck.

This commit introduce new function mke2fs_discard_device(), which is a
wrapper for io_channel_discard(). The discard is done in chunks of
2GB, which seems reasonably well for both slow and fast devices, and
discard progress is reported back to the user.

I gave up on doing fancy things like align discard according to
discard_alignment, checking for discard granularity and computing
estimate time. First of all, because it would require either new ioctl
to retrieve those information or use of libudev library, none of it
seems to be worth it. Regarding discard_granularity, I doubt there is
any sane device with discard granularity that big it would affect this.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-02-20 21:55:33 -05:00
Theodore Ts'o 214580a339 Merge branch 'maint' into next
Conflicts:
	misc/mke2fs.conf.5.in
2011-02-20 21:54:43 -05:00
Lukas Czerner 855a77a197 mke2fs: Simple man page nodiscard option correction
It is not true that 'nodiscard' is set as default, so remove this
sentence. The default is 'discard' and it is properly documented in man
page.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-02-20 21:50:24 -05:00
Eric Sandeen 6a426c97ec e2fsprogs: enable user namespace xattrs by default
User namespace xattrs are generally useful, and I think extN
is the only filesystem requiring a special mount option to
enable them, when xattrs are otherwise available.  So this
change sets that mount option into the defaults, via a
mke2fs.conf option.

Note that if xattrs are config'd off, this will lead to a
mostly-harmless:

   EXT4-fs (sdc1): (no)user_xattr options not supported

message at mount time...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-02-20 21:36:26 -05:00
Eric Sandeen 3daf592646 e2fsprogs: turn off enforced fsck intervals by default
The forced fsck often comes at unexpected and inopportune moments,
and even enterprise customers are often caught by surprise when
this happens.  Because a filesystem with an error condition will
be marked as requiring fsck anyway, I submit that the time-based
and mount-based checks are not particularly useful, and that
administrators can schedule fscks on their own time, or tune2fs
the enforced intervals if they so choose.  This patch disables the
intervals by default, and I've added a new mkfs.conf option to
turn on the old behavior of random, unexpected, time-consuming
fscks at boot time.  ;)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-02-20 20:45:12 -05:00
Theodore Ts'o 89d4597510 badblocks: Add accounting for different types of errors
When using the -v option, report a breakdown of the number of read,
write, and comparison errors that were found by badblocks.

Thanks to Ragnar Kjørstad for providing this patch.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-02-20 15:29:51 -05:00
Theodore Ts'o 39791dc0bd badblocks: Fix up recover_block handling in badblocks
If there was a bad block for block #0, badblocks would never switch
back testing blocks more efficiently.  In addition, we were
double-incrementing the blocks to be tested in the read/write test due
to failure to remove code.

Thanks to Ragnar Kjørstad for pointing these problems out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-02-20 15:19:47 -05:00
Theodore Ts'o 175d43bead Merge branch 'maint' into next 2011-02-18 01:19:05 -05:00
Theodore Ts'o 468d82f430 badblocks: Only report errors when reading/writing one block at a time
With Direct I/O, the kernel can report 0 bytes read even though the
first block has no errors.  So there are any errors, we need try to
read/write blocks one at a time and to get an accurate report.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-02-18 01:16:03 -05:00
Theodore Ts'o e53e8fb009 badblocks: Add the -B option which forces the use of buffered I/O
If for some reason direct I/O does not work correctly, force the use
of buffered I/O.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-02-18 01:16:02 -05:00
Theodore Ts'o 7d6840354a badblocks: Fix bug so that O_DIRECT mode is correctly entered
The check to see if the block number is properly aligned was not done
correctly.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-02-18 01:09:39 -05:00
Theodore Ts'o 616f68bf77 Merge branch 'maint' into next 2011-02-10 19:04:46 -05:00
Jim Meyering b637f8e7ed filefrag: remove useless assignment
The very next one memset's all bytes of fiemap to 0.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-02-06 19:01:25 -05:00
Kazuya Mio 9ac557a1df e4defrag: Use libext2fs to get the correct superblock information
Currently, e4defrag always does byte-swapping when it gets superblock
information, so the calculation of the best extents count is not
correct on little endian machine. This doesn't cause data corruption,
but it may confuse users by showing the wrong extent count.  To solve
this problem, we use ext2fs_open() instead of get_superblock_info()
that is the original function.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-24 16:56:24 -05:00
Theodore Ts'o 8d9c50c557 configure: control whether e4defrag is built/installed via --disable-defrag
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-24 15:19:44 -05:00
Kazuya Mio b07f014fac e4defrag: fix segfault when e4defrag races with unlink/truncate
If a file gets deleted or truncated while e4defrag is trying to
operate on it, it's possible for it seg fault.

Addresses-Red-Hat-Bugzilla: #641926

Reported-by: Michal Piotrowski <mkkp4x4@gmail.com>
Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-24 14:43:13 -05:00
Theodore Ts'o da2a5a4bae Merge branch 'maint' into next
Conflicts:
	resize/resize2fs.c
2010-12-22 19:00:21 -05:00
Theodore Ts'o 0f7479b340 mke2fs: don't complain if the fs type "default" is not defined in mke2fs.conf
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-22 18:31:36 -05:00
Theodore Ts'o 9b27e9cc32 mke2fs: take the device size into account when determining the size type
If the file system size was not specified on the command line, we were
always using the usage type "floppy" since we didn't determine the
device size until after calling parse_fs_types().  Doh!

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-22 18:22:40 -05:00
Namhyung Kim 5182ad4c21 mke2fs.8.in: add ENVIRONMENT section
Add ENVIRONMENT section and describe behavior of MKE2FS_SYNC,
MKE2FS_CONFIG, MKE2FS_FIRST_META_BG, MKE2FS_DEVICE_SECTSIZE
and MKE2FS_SKIP_CHECK_MSG.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-22 10:43:01 -05:00
Theodore Ts'o 8a1cf3c243 mke2fs: clean up error handling in mke2fs_setup_tdb()
Avoid memory leaks on error paths, and make sure we issue the correct
error messages in the case of (highly) unlikely errors.

Original patch submitted by Namhyung Kim <namhyung@gmail.com>, but
highly rewritten since then.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-21 21:57:02 -05:00
Namhyung Kim 9ec68af7b6 mke2fs: add some error checks into PRS()
Check return value of some functions and exit if unhandled error occurred.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-21 20:31:26 -05:00
Namhyung Kim 22d8ce512f mke2fs: fix determination of size_type
In original code, 'huge' type could not be selected because it
always be caught for 'big' type. Change the ordering.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-21 18:44:56 -05:00
Namhyung Kim 9a2767ffed mke2fs.8.in: add missing "big" and "huge" usage-type description
The commit 493024ea1d ("mke2fs: Fix up the
fs type and feature selection for 64-bit blocks") added 'big' and 'huge'
usage-type but was missing description in man page. Add it.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-21 18:43:59 -05:00
Theodore Ts'o 74e1211b23 mke2fs: Avoid potential NULL dereference
... in the very unlikely case that e2p_os2string fails to allocate
memory.

Reported-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-21 18:12:12 -05:00
Theodore Ts'o e163242102 mke2fs: Use ext2fs_div_ceil to simplify write_inode_tables()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-20 10:42:57 -05:00
Theodore Ts'o 25623feab4 Merge branch 'master' into next
Conflicts:
	e2fsck/e2fsck.h
	e2fsck/unix.c
2010-12-16 23:20:11 -05:00
Theodore Ts'o 30c0529d27 e4defrag: Fix the overflow in e4defrag with > 2GB files
The fallocate() interface on 32-bit machines is defined to use off_t,
not loff_t (even though the system call interface is 64-bit clean).
This causes e4defrag to fail on files greater than 2GB.  Fix this by
trying to use fallocate64(), and using the hard-coded syscall if it
does not exist.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-16 22:53:34 -05:00
Kazuya Mio 77e72e2b8e e4defrag: update man page about -c option
Add the description of the size per one extent and the maximum extent size
in ext4 into e4defrag man page.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-13 09:59:07 -05:00
Kazuya Mio 4baacad703 e4defrag: avoid unsuccessful return for an non-privileged user
If non-privileged user runs e4defrag, e4defrag returns an exit status
of 1 despite its success. This patch fixes this problem.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-13 09:59:07 -05:00
Kazuya Mio 02808f7d9a e4defrag: fix file blocks calculation
e4defrag uses st_blocks (struct stat) to calculate file blocks. However,
st_blocks also has meta data blocks in addition to file blocks. So, we
calculate file blocks by sum of the extent length.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-13 09:59:06 -05:00
Kazuya Mio 94d26c267d e4defrag: output size per extent by -c option
e4defrag with -c option outputs "ratio" that means the levels of
fragmentation. However, it's difficult for users to understand, so we will
use size per extent instead of ratio.

Before:
# e4defrag -c /mnt/mp1/file
<File>                                         now/best          ratio
/mnt/mp1/file                                    6/1             0.00%

 Total/best extents                             6/1
 Fragmentation ratio                            0.00%
 Fragmentation score                            0.04
 [0-30 no problem: 31-55 a little bit fragmented: 55- needs defrag]
 This file(/mnt/mp1/file) does not need defragmentation.
 Done.

After:
# e4defrag -c /mnt/mp1/file
<File>                                         now/best       size/ext
/mnt/mp1/file                                    6/1          16666 KB

 Total/best extents                             6/1
 Average size per extent                        16666 KB
 Fragmentation score                            0
 [0-30 no problem: 31-55 a little bit fragmented: 56- needs defrag]
 This file (/mnt/mp1/file) does not need defragmentation.
 Done.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-13 09:57:26 -05:00
Peng Tao ae09b934a7 e4defrag: return more specific error message on ioctl failure
Currently e4defrag relies on the EXT4_IOC_MOVE_EXT ioctl to perform online
defragmentation. However, this iotcl kernel patch is not available before
2.6.30-rc1. e4defrag shall fail without obvious reasons on systems running
older kernels. The patch adds more detailed error message addressing this
issue and prompts users with the minimal kernel version that is needed to
run e4defrag.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-13 09:44:57 -05:00
Eric Sandeen 43eb2ad477 e4defrag: skip "rootfs" entry when checking for ext4 filesystem
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-13 09:29:19 -05:00
Darrick J. Wong 90b9dce3e5 e4defrag: open the file to be defragged in read/write mode
Akira Fujita merged a patch into 2.6.33 that adds a requirement that a
file being defragged must be opened with read and write access, so
e2fsprogs needs to satisfy that.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-13 09:23:45 -05:00
Theodore Ts'o 0358c9f9a4 Merge branch 'maint' into next
Conflicts:
	e2fsck/pass4.c
	misc/dumpe2fs.c
	resize/online.c
2010-12-13 09:16:09 -05:00
Andreas Dilger 0e2afdbacc dumpe2fs: fix output for flex_bg bitmap offsets
When running dumpe2fs on a filesystem formatted with flex_bg, it
prints out the relative offsets for the bitmaps and inode table
badly on 64-bit systems, because the offset is computed as a
large positive number instead of being a negative numer (which
will not be printed at all):

Group 1: (Blocks 0x8000-0xffff) [INODE_UNINIT, ITABLE_ZEROED]
 Block bitmap at 0x0102 (+4294934786), Inode bitmap at 0x0202 (+4294935042)
 Inode table at 0x037e-0x03fa (+4294935422)

This commit prints out the relative offsets for flex_bg
groups as the offset within the reported group.  This makes it
more clear where the metadata is located, rather than simply
printing some large negative number.

Group 1: (Blocks 0x8000-0xffff) [INODE_UNINIT, ITABLE_ZEROED]
 Block bitmap at 0x0102 (bg #0 +258), Inode bitmap at 0x0202 (bg #0 +514)
 Inode table at 0x037e-0x03fa (bg #0 +894)

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-05 22:20:19 -05:00
Theodore Ts'o 5a2db04637 mke2fs: Fix (minor) memory leaks
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-01 18:49:26 -05:00
Theodore Ts'o 2ee4544d07 mke2fs: Fail if the requested file system type is not defined in mke2fs.conf
If the user passes a file system type which is not defined in
mke2fs.conf (i.e., mke2fs -t xfs ...) change mke2fs so that it prints
a warning and aborts the run.  (There is an exception for ext2, since
that file system does not need a special definition in the fs_types
section of the /etc/mke2fs.conf file.)

In addition, print a warning if there are usage types (specified using
the -T option) which are not defined in /etc/mke2fs.conf.

Addresses-Debian-Bug: #594609

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-01 18:28:35 -05:00
Lukas Czerner 7361c08e5d mke2fs: Use unix_discard() for discards
There is generic discard function in struct_io_manager, or in
unix_io_manager to be specific. So use this instead of
mke2fs_discard_blocks().

Since mke2fs_discard_blocks() is not used anymore (and should not be)
remove it.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-11-22 21:14:28 -05:00