ZEROFREE(8) System Manager's Manual ZEROFREE(8)
NAME
zerofree — zero free blocks from ext2, ext3 and ext4 file-systems
SYNOPSIS
zerofree [-n] [-v] [-f fillval] filesystem
DESCRIPTION
zerofree finds the unallocated, blocks with non-zero value content in an ext2, ext3 or ext4 filesystem (e.g. /dev/hda1) and fills them with zeroes (or another octet of your choice).
Filling unused areas with zeroes is useful if the device on which this file-system resides is a disk image. In this case, depending on the type of disk image, a secondary utility may be able to re‐
duce the size of the disk image after zerofree has been run.
Filling unused areas may also be useful with solid-state drives (SSDs). On some SSDs, filling blocks with ones (0xFF) is reported to trigger Flash block erasure by the firmware, possibly giving a
write performance increase.
The usual way to achieve the same result (zeroing the unallocated blocks) is to run dd (1) to create a file full of zeroes that takes up the entire free space on the drive, and then delete this
file. This has many disadvantages, which zerofree alleviates:
• it is slow;
• it makes the disk image (temporarily) grow to its maximal extent;
• it (temporarily) uses all free space on the disk, so other concurrent write actions may fail.
filesystem has to be unmounted or mounted read-only for zerofree to work. It will exit with an error message if the filesystem is mounted writable. To remount the root file-system readonly, you can
first switch to single user runlevel (telinit 1) then use mount -o remount,ro filesystem.
zerofree has been written to be run from GNU/Linux systems installed as guest OSes inside a virtual machine. In this case, it is typically run from within the guest system, and a utility is then run
from the host system to shrink disk image (VBoxManage modifyhd --compact, provided with virtualbox, is able to do that for some disk image formats).
It may however be useful in other situations: for instance it can be used to make it more difficult to retrieve deleted data. Beware that securely deleting sensitive data is not in general an easy
task and usually requires writing several times on the deleted blocks.
OPTIONS
-n Perform a dry run (do not modify the file-system);
-v Be verbose: show the number of blocks modified by zerofree (or that would be modified, in case the -n is used), the number of free blocks and the total number of blocks on the filesystem;
-f value Specify the octet value to fill empty blocks with (defaults to 0). Argument must be within the range 0 to 255.
SEE ALSO
dd (1).
AUTHOR
This manual page was written by Thibaut Paumard <paumard@users.sourceforge.net> for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this docu‐
ment under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation.
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2.
ZEROFREE(8)
time sudo zerofree -v /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer.iso
Output:
14709203/16204235/61035008
real 4m24.833s
user 0m0.026s
sys 0m0.058s
DuckDuckGo search zerofree output meaning.
Based on man 14709203 / 61035008 = 24 % are now zero, so can earn at most 256 * 24 / 100 = 61.4 GB.
Unclear if modified means where not value to write.
mksquashfs
Output:
SYNTAX:mksquashfs source1 source2 ... FILESYSTEM [OPTIONS] [-e list of
exclude dirs/files]
Filesystem build options:
-tar read uncompressed tar file from standard in (stdin)
-no-strip act like tar, and do not strip leading directories
from source files
-tarstyle alternative name for -no-strip
-cpiostyle act like cpio, and read files from standard in (stdin)
-cpiostyle0 like -cpiostyle, but filenames are null terminated
-comp <comp> select <comp> compression
Compressors available:
gzip (default)
lzo
lz4
xz
zstd
lzma
-b <block_size> set data block to <block_size>. Default 128 Kbytes.
Optionally a suffix of K or M can be given to specify
Kbytes or Mbytes respectively
-reproducible build filesystems that are reproducible (default)
-not-reproducible build filesystems that are not reproducible
-mkfs-time <time> set filesystem creation timestamp to <time>, which is
an unsigned 32-bit int indicating seconds since the
epoch (1970-01-01)
-fstime <time> synonym for mkfs-time
-all-time <time> set all file timestamps to <time>, which is an unsigned
32-bit int indicating seconds since the epoch
(1970-01-01)
-no-exports don't make filesystem exportable via NFS (-tar default)
-exports make filesystem exportable via NFS (default)
-no-sparse don't detect sparse files
-no-xattrs don't store extended attributes
-xattrs store extended attributes (default)
-noI do not compress inode table
-noId do not compress the uid/gid table (implied by -noI)
-noD do not compress data blocks
-noF do not compress fragment blocks
-noX do not compress extended attributes
-no-tailends don't pack tail ends into fragments (default)
-tailends pack tail ends into fragments
-no-fragments do not use fragments
-always-use-fragments use fragment blocks for files larger than block size
-no-duplicates do not perform duplicate checking
-no-hardlinks do not hardlink files, instead store duplicates
-all-root make all files owned by root
-root-time <time> set root directory time to <time>
-root-mode <mode> set root directory permissions to octal <mode>
-root-uid <uid> set root directory owner to <uid>
-root-gid <gid> set root directory group to <gid>
-force-uid <uid> set all file uids to <uid>
-force-gid <gid> set all file gids to <gid>
-keep-as-directory if one source directory is specified, create a root
directory containing that directory, rather than the
contents of the directory
-action <action@expr> evaluate <expr> on every file, and execute <action>
if it returns TRUE
-log-action <act@expr> as above, but log expression evaluation results and
actions performed
-true-action <act@expr> as above, but only log expressions which return TRUE
-false-action <act@exp> as above, but only log expressions which return FALSE
-action-file <file> as action, but read actions from <file>
-log-action-file <file> as -log-action, but read actions from <file>
-true-action-file <f> as -true-action, but read actions from <f>
-false-action-file <f> as -false-action, but read actions from <f>
Filesystem filter options:
-p <pseudo-definition> Add pseudo file definition. The definition should
be quoted
-pf <pseudo-file> Add list of pseudo file definitions. Pseudo file
definitions in pseudo-files should not be quoted
-sort <sort_file> sort files according to priorities in <sort_file>. One
file or dir with priority per line. Priority -32768 to
32767, default priority 0
-ef <exclude_file> list of exclude dirs/files. One per line
-wildcards Allow extended shell wildcards (globbing) to be used in
exclude dirs/files
-regex Allow POSIX regular expressions to be used in exclude
dirs/files
-one-file-system Do not cross filesystem boundaries when scanning sources
Filesystem append options:
-noappend do not append to existing filesystem
-root-becomes <name> when appending source files/directories, make the
original root become a subdirectory in the new root
called <name>, rather than adding the new source items
to the original root
Mksquashfs runtime options:
-version print version, licence and copyright message
-exit-on-error treat normally ignored errors as fatal
-recover <name> recover filesystem data using recovery file <name>
-no-recovery don't generate a recovery file
-recovery-path <name> use <name> as the directory to store the recovery file
-quiet no verbose output
-info print files written to filesystem
-no-progress don't display the progress bar
-progress display progress bar when using the -info option
-throttle <percentage> throttle the I/O input rate by the given percentage.
This can be used to reduce the I/O and CPU consumption
of Mksquashfs
-limit <percentage> limit the I/O input rate to the given percentage.
This can be used to reduce the I/O and CPU consumption
of Mksquashfs (alternative to -throttle)
-processors <number> Use <number> processors. By default will use number of
processors available
-mem <size> Use <size> physical memory. Currently set to 3917M
Optionally a suffix of K, M or G can be given to specify
Kbytes, Mbytes or Gbytes respectively
Expert options (these may make the filesystem unmountable):
-nopad do not pad filesystem to a multiple of 4K
-offset <offset> Skip <offset> bytes at the beginning of FILESYSTEM.
Optionally a suffix of K, M or G can be given to specify
Kbytes, Mbytes or Gbytes respectively.
Default 0 bytes
-o <offset> synonym for -offset
Miscellaneous options:
-root-owned alternative name for -all-root
-noInodeCompression alternative name for -noI
-noIdTableCompression alternative name for -noId
-noDataCompression alternative name for -noD
-noFragmentCompression alternative name for -noF
-noXattrCompression alternative name for -noX
-help output this options text to stdout
-h output this options text to stdout
-Xhelp print compressor options for selected compressor
Pseudo file definition format:
"filename d mode uid gid" create a directory
"filename m mode uid gid" modify filename
"filename b mode uid gid major minor" create a block device
"filename c mode uid gid major minor" create a character device
"filename f mode uid gid command" create file from stdout of command
"filename s mode uid gid symlink" create a symbolic link
"filename i mode uid gid [s|f]" create a socket (s) or FIFO (f)
"filename l linkname" create a hard-link to linkname
"filename L pseudo_filename" same, but link to pseudo file
"filename D time mode uid gid" create a directory with timestamp time
"filename M time mode uid gid" modify a file with timestamp time
"filename B time mode uid gid major minor"
create block device with timestamp time
"filename C time mode uid gid major minor"
create char device with timestamp time
"filename F time mode uid gid command" create file with timestamp time
"filename S time mode uid gid symlink" create symlink with timestamp time
"filename I time mode uid gid [s|f]" create socket/fifo with timestamp time
Compressors available and compressor specific options:
gzip (default)
-Xcompression-level <compression-level>
<compression-level> should be 1 .. 9 (default 9)
-Xwindow-size <window-size>
<window-size> should be 8 .. 15 (default 15)
-Xstrategy strategy1,strategy2,...,strategyN
Compress using strategy1,strategy2,...,strategyN in turn
and choose the best compression.
Available strategies: default, filtered, huffman_only,
run_length_encoded and fixed
lzo
-Xalgorithm <algorithm>
Where <algorithm> is one of:
lzo1x_1
lzo1x_1_11
lzo1x_1_12
lzo1x_1_15
lzo1x_999 (default)
-Xcompression-level <compression-level>
<compression-level> should be 1 .. 9 (default 8)
Only applies to lzo1x_999 algorithm
lz4
-Xhc
Compress using LZ4 High Compression
xz
-Xbcj filter1,filter2,...,filterN
Compress using filter1,filter2,...,filterN in turn
(in addition to no filter), and choose the best compression.
Available filters: x86, arm, armthumb, powerpc, sparc, ia64
-Xdict-size <dict-size>
Use <dict-size> as the XZ dictionary size. The dictionary size
can be specified as a percentage of the block size, or as an
absolute value. The dictionary size must be less than or equal
to the block size and 8192 bytes or larger. It must also be
storable in the xz header as either 2^n or as 2^n+2^(n+1).
Example dict-sizes are 75%, 50%, 37.5%, 25%, or 32K, 16K, 8K
etc.
zstd
-Xcompression-level <compression-level>
<compression-level> should be 1 .. 22 (default 15)
lzma
(no options) (deprecated - no kernel support)
Environment:
SOURCE_DATE_EPOCH If set, this is used as the filesystem creation
timestamp. Also any file timestamps which are
after SOURCE_DATE_EPOCH will be clamped to
SOURCE_DATE_EPOCH. See
https://reproducible-builds.org/docs/source-date-epoch/
for more information
See also:
The README for the Squash-tools 4.5.1 release, describing the new features can be
read here https://github.com/plougher/squashfs-tools/blob/master/README-4.5.1
The Squashfs-tools USAGE guide can be read here
https://github.com/plougher/squashfs-tools/blob/master/USAGE
The ACTIONS-README file describing how to use the new actions feature can be
read here https://github.com/plougher/squashfs-tools/blob/master/ACTIONS-README
ls -lh /media/benjamin_loison/64XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXd8/SSDServer-squash.img
time sudo mksquashfs /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer{,_squash}.iso
Output:
Parallel mksquashfs: Using 24 processors
Creating 4.0 filesystem on /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso, block size 131072.
[==========================================================================================================================================================================================|] 1907344/1907344 100%>
Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
compressed data, compressed metadata, compressed fragments,
compressed xattrs, compressed ids
duplicates are removed
Filesystem size 67064143.13 Kbytes (65492.33 Mbytes)
27.47% of uncompressed filesystem size (244147484.63 Kbytes)
Inode table size 2776566 bytes (2711.49 Kbytes)
36.38% of uncompressed inode table size (7631328 bytes)
Directory table size 33 bytes (0.03 Kbytes)
94.29% of uncompressed directory table size (35 bytes)
Number of duplicate files found 0
Number of inodes 2
Number of files 1
Number of fragments 0
Number of symbolic links 0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 1
Number of hard-links 0
Number of ids (unique uids + gids) 1
Number of uids 1
root (0)
Number of gids 1
root (0)
real 25m48.123s
user 0m0.107s
sys 0m0.170s
ls -lh /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso
-rw-r--r-- 1 root root 64G Aug 3 02:25 /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso
ls -l /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso
-rw-r--r-- 1 root root 68673683456 Aug 3 02:25 /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/pegasus--vg-root 731G 554G 141G 80% /
ls -lh test.iso
-rw-r--r-- 1 benjamin_loison benjamin_loison 5.0G Aug 3 02:45 test.iso
sudo mkfs.btrfs
Output:
btrfs-progs v6.2
See http://btrfs.wiki.kernel.org for more information.
usage: mkfs.btrfs [options] <dev> [<dev...>]
Create a BTRFS filesystem on a device or multiple devices
Allocation profiles:
-d|--data PROFILE data profile, raid0, raid1, raid1c3, raid1c4, raid5, raid6, raid10, dup or single
-m|--metadata PROFILE metadata profile, values like for data profile
-M|--mixed mix metadata and data together
Features:
--csum TYPE
--checksum TYPE checksum algorithm to use, crc32c (default), xxhash, sha256, blake2
-n|--nodesize SIZE size of btree nodes
-s|--sectorsize SIZE data block size (may not be mountable by current kernel)
-O|--features LIST comma separated list of filesystem features (use '-O list-all' to list features)
-R|--runtime-features LIST
comma separated list of runtime features (use '-R list-all' to list runtime features)
-L|--label LABEL set the filesystem label
-U|--uuid UUID specify the filesystem UUID (must be unique)
Creation:
-b|--byte-count SIZE set size of each device to SIZE (filesystem size is sum of all device sizes)
-r|--rootdir DIR copy files from DIR to the image root directory
--shrink (with --rootdir) shrink the filled filesystem to minimal size
-K|--nodiscard do not perform whole device TRIM
-f|--force force overwrite of existing filesystem
General:
-q|--quiet no messages except errors
-v|--verbose increase verbosity level, default is 1
-V|--version print the mkfs.btrfs version and exit
--help print this help and exit
Deprecated:
-l|--leafsize SIZE removed in 6.0, use --nodesize
mount: a/: failed to setup loop device for /home/benjamin_loison/test.iso.
sudo mount test.iso a/
does not return anything.
ls -lha a/
Output:
total 24K
drwxr-xr-x 3 root root 4.0K Aug 3 02:48 .
drwx--x---+ 44 benjamin_loison benjamin_loison 4.0K Aug 3 02:48 ..
drwx------ 2 root root 16K Aug 3 02:48 lost+found
umount a/
umount: /home/benjamin_loison/a: must be superuser to unmount.
sudo umount a/
does not return anything.
sudo mkfs.btrfs test.iso
Output:
btrfs-progs v6.2
See http://btrfs.wiki.kernel.org for more information.
NOTE: several default settings have changed in version 5.15, please make sure
this does not affect your deployments:
- DUP for metadata (-m dup)
- enabled no-holes (-O no-holes)
- enabled free-space-tree (-R free-space-tree)
Label: (null)
UUID: b7095905-987f-444b-af34-573aa57d42cd
Node size: 16384
Sector size: 4096
Filesystem size: 5.00GiB
Block group profiles:
Data: single 8.00MiB
Metadata: DUP 256.00MiB
System: DUP 8.00MiB
SSD detected: no
Zoned device: no
Incompat features: extref, skinny-metadata, no-holes
Runtime features: free-space-tree
Checksum: crc32c
Number of devices: 1
Devices:
ID SIZE PATH
1 5.00GiB test.iso
sudo mount test.iso a/
does not return anything.
ls -lah a/
Output:
total 20K
drwxr-xr-x 1 root root 0 Aug 3 02:51 .
drwx--x---+ 44 benjamin_loison benjamin_loison 4.0K Aug 3 02:51 ..
DuckDuckGo and Google search btrfs enable compression.
134128288+0 records iniB/s] [==================================================================================================================================================================> ] 99% ETA 0:00:00
134128288+0 records out
68673683456 bytes (69 GB, 64 GiB) copied, 1344.43 s, 51.1 MB/s
64.0GiB 0:22:24 [48.7MiB/s] [===================================================================================================================================================================>] 100%
134128288+0 records in
134128288+0 records out
68673683456 bytes (69 GB, 64 GiB) copied, 1343.55 s, 51.1 MB/s
DuckDuckGo search *Linux sparsify disk* and *Linux replace unused space with zeros*.
[The Unix Stack Exchange answer 44236](https://unix.stackexchange.com/a/44236) helps.
```
sudo zerofree
```
```
usage: zerofree [-n] [-v] [-f fillval] filesystem
```
```
sudo zerofree /media/benjamin_loison/d0XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXc0/
```
```
zerofree: failed to open filesystem /media/benjamin_loison/d0XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXc0/
```
```
sudo zerofree /media/benjamin_loison/disk/SSDServer.iso
```
```
zerofree: failed to open filesystem /media/benjamin_loison/disk/SSDServer.iso
```
```
file SSDServer-squash.img
```
```
SSDServer-squash.img: Squashfs filesystem, little endian, version 4.0, zlib compressed, 89841958468 bytes, 2 inodes, blocksize: 131072 bytes, created: Sun Sep 11 23:26:39 2022
```
DuckDuckGo and Google search *zerofill squashfs* and `"zerofill" "squashfs"`.
> Squashfs is a compressed read-only file system for Linux.
Source: [Wikipedia: SquashFS (1287034981)](https://en.wikipedia.org/w/index.php?title=SquashFS&oldid=1287034981)
[Wikipedia: Comparison_of_file_systems#Block capabilities (1303557071)](https://en.wikipedia.org/w/index.php?title=Comparison_of_file_systems&oldid=1303557071#Block_capabilities) *Deduplication* and *Compression*)
[Wikipedia: Comparison of file systems#Allocation and layout policies (1303557071)](https://en.wikipedia.org/w/index.php?title=Comparison_of_file_systems&oldid=1303557071#Allocation_and_layout_policies) *Sparse files* may be relevant
DuckDuckGo and Google search *Linux compressed read-write file system*, *Linux compress iso* and *dd without zeros*.
```bash
dd --help
```
<details>
<summary>Output:</summary>
```
Each CONV symbol may be:
...
sparse try to seek rather than write all-NUL output blocks
```
</details>
```
man dd
```
<details>
<summary>Output:</summary>
```
Each CONV symbol may be:
...
sparse try to seek rather than write all-NUL output blocks
```
</details>
DuckDuckGo search `"dd" "sparse"`.
```bash
FILE=/media/benjamin_loison/disk/SSDServer.iso; dd if=$FILE | pv --size `wc -c $FILE | cut -d ' ' -f 1` | sudo dd of=/media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer.iso
```
<details>
<summary>Output:</summary>
```
488280064+0 records iniB/s] [==================================================================================================================================================================> ] 99% ETA 0:00:00
488280064+0 records out
249999392768 bytes (250 GB, 233 GiB) copied, 2467.93 s, 101 MB/s
232GiB 0:41:07 [96.6MiB/s] [===================================================================================================================================================================>] 100%
488280064+0 records in
488280064+0 records out
249999392768 bytes (250 GB, 233 GiB) copied, 2467.98 s, 101 MB/s
```
</details>
```
ls -lh /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer.iso
```
```
-rw-r--r-- 1 root root 233G Aug 3 01:45 /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer.iso
```
```
ls -l /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer.iso
```
```
-rw-r--r-- 1 root root 249999392768 Aug 3 01:45 /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer.iso
```
```
sudo zerofree --help
```
<details>
<summary>Output:</summary>
```
zerofree: invalid option -- '-'
usage: zerofree [-n] [-v] [-f fillval] filesystem
```
</details>
```
man zerofree
```
<details>
<summary>Output:</summary>
```
ZEROFREE(8) System Manager's Manual ZEROFREE(8)
NAME
zerofree — zero free blocks from ext2, ext3 and ext4 file-systems
SYNOPSIS
zerofree [-n] [-v] [-f fillval] filesystem
DESCRIPTION
zerofree finds the unallocated, blocks with non-zero value content in an ext2, ext3 or ext4 filesystem (e.g. /dev/hda1) and fills them with zeroes (or another octet of your choice).
Filling unused areas with zeroes is useful if the device on which this file-system resides is a disk image. In this case, depending on the type of disk image, a secondary utility may be able to re‐
duce the size of the disk image after zerofree has been run.
Filling unused areas may also be useful with solid-state drives (SSDs). On some SSDs, filling blocks with ones (0xFF) is reported to trigger Flash block erasure by the firmware, possibly giving a
write performance increase.
The usual way to achieve the same result (zeroing the unallocated blocks) is to run dd (1) to create a file full of zeroes that takes up the entire free space on the drive, and then delete this
file. This has many disadvantages, which zerofree alleviates:
• it is slow;
• it makes the disk image (temporarily) grow to its maximal extent;
• it (temporarily) uses all free space on the disk, so other concurrent write actions may fail.
filesystem has to be unmounted or mounted read-only for zerofree to work. It will exit with an error message if the filesystem is mounted writable. To remount the root file-system readonly, you can
first switch to single user runlevel (telinit 1) then use mount -o remount,ro filesystem.
zerofree has been written to be run from GNU/Linux systems installed as guest OSes inside a virtual machine. In this case, it is typically run from within the guest system, and a utility is then run
from the host system to shrink disk image (VBoxManage modifyhd --compact, provided with virtualbox, is able to do that for some disk image formats).
It may however be useful in other situations: for instance it can be used to make it more difficult to retrieve deleted data. Beware that securely deleting sensitive data is not in general an easy
task and usually requires writing several times on the deleted blocks.
OPTIONS
-n Perform a dry run (do not modify the file-system);
-v Be verbose: show the number of blocks modified by zerofree (or that would be modified, in case the -n is used), the number of free blocks and the total number of blocks on the filesystem;
-f value Specify the octet value to fill empty blocks with (defaults to 0). Argument must be within the range 0 to 255.
SEE ALSO
dd (1).
AUTHOR
This manual page was written by Thibaut Paumard <paumard@users.sourceforge.net> for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this docu‐
ment under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation.
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2.
ZEROFREE(8)
```
</details>
```
time sudo zerofree -v /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer.iso
```
<details>
<summary>Output:</summary>
```
14709203/16204235/61035008
real 4m24.833s
user 0m0.026s
sys 0m0.058s
```
</details>
DuckDuckGo search *zerofree output meaning*.
Based on `man` 14709203 / 61035008 = 24 % are now zero, so can earn at most 256 * 24 / 100 = 61.4 GB.
Unclear if modified means where not value to write.
```
mksquashfs
```
<details>
<summary>Output:</summary>
```
SYNTAX:mksquashfs source1 source2 ... FILESYSTEM [OPTIONS] [-e list of
exclude dirs/files]
Filesystem build options:
-tar read uncompressed tar file from standard in (stdin)
-no-strip act like tar, and do not strip leading directories
from source files
-tarstyle alternative name for -no-strip
-cpiostyle act like cpio, and read files from standard in (stdin)
-cpiostyle0 like -cpiostyle, but filenames are null terminated
-comp <comp> select <comp> compression
Compressors available:
gzip (default)
lzo
lz4
xz
zstd
lzma
-b <block_size> set data block to <block_size>. Default 128 Kbytes.
Optionally a suffix of K or M can be given to specify
Kbytes or Mbytes respectively
-reproducible build filesystems that are reproducible (default)
-not-reproducible build filesystems that are not reproducible
-mkfs-time <time> set filesystem creation timestamp to <time>, which is
an unsigned 32-bit int indicating seconds since the
epoch (1970-01-01)
-fstime <time> synonym for mkfs-time
-all-time <time> set all file timestamps to <time>, which is an unsigned
32-bit int indicating seconds since the epoch
(1970-01-01)
-no-exports don't make filesystem exportable via NFS (-tar default)
-exports make filesystem exportable via NFS (default)
-no-sparse don't detect sparse files
-no-xattrs don't store extended attributes
-xattrs store extended attributes (default)
-noI do not compress inode table
-noId do not compress the uid/gid table (implied by -noI)
-noD do not compress data blocks
-noF do not compress fragment blocks
-noX do not compress extended attributes
-no-tailends don't pack tail ends into fragments (default)
-tailends pack tail ends into fragments
-no-fragments do not use fragments
-always-use-fragments use fragment blocks for files larger than block size
-no-duplicates do not perform duplicate checking
-no-hardlinks do not hardlink files, instead store duplicates
-all-root make all files owned by root
-root-time <time> set root directory time to <time>
-root-mode <mode> set root directory permissions to octal <mode>
-root-uid <uid> set root directory owner to <uid>
-root-gid <gid> set root directory group to <gid>
-force-uid <uid> set all file uids to <uid>
-force-gid <gid> set all file gids to <gid>
-keep-as-directory if one source directory is specified, create a root
directory containing that directory, rather than the
contents of the directory
-action <action@expr> evaluate <expr> on every file, and execute <action>
if it returns TRUE
-log-action <act@expr> as above, but log expression evaluation results and
actions performed
-true-action <act@expr> as above, but only log expressions which return TRUE
-false-action <act@exp> as above, but only log expressions which return FALSE
-action-file <file> as action, but read actions from <file>
-log-action-file <file> as -log-action, but read actions from <file>
-true-action-file <f> as -true-action, but read actions from <f>
-false-action-file <f> as -false-action, but read actions from <f>
Filesystem filter options:
-p <pseudo-definition> Add pseudo file definition. The definition should
be quoted
-pf <pseudo-file> Add list of pseudo file definitions. Pseudo file
definitions in pseudo-files should not be quoted
-sort <sort_file> sort files according to priorities in <sort_file>. One
file or dir with priority per line. Priority -32768 to
32767, default priority 0
-ef <exclude_file> list of exclude dirs/files. One per line
-wildcards Allow extended shell wildcards (globbing) to be used in
exclude dirs/files
-regex Allow POSIX regular expressions to be used in exclude
dirs/files
-one-file-system Do not cross filesystem boundaries when scanning sources
Filesystem append options:
-noappend do not append to existing filesystem
-root-becomes <name> when appending source files/directories, make the
original root become a subdirectory in the new root
called <name>, rather than adding the new source items
to the original root
Mksquashfs runtime options:
-version print version, licence and copyright message
-exit-on-error treat normally ignored errors as fatal
-recover <name> recover filesystem data using recovery file <name>
-no-recovery don't generate a recovery file
-recovery-path <name> use <name> as the directory to store the recovery file
-quiet no verbose output
-info print files written to filesystem
-no-progress don't display the progress bar
-progress display progress bar when using the -info option
-throttle <percentage> throttle the I/O input rate by the given percentage.
This can be used to reduce the I/O and CPU consumption
of Mksquashfs
-limit <percentage> limit the I/O input rate to the given percentage.
This can be used to reduce the I/O and CPU consumption
of Mksquashfs (alternative to -throttle)
-processors <number> Use <number> processors. By default will use number of
processors available
-mem <size> Use <size> physical memory. Currently set to 3917M
Optionally a suffix of K, M or G can be given to specify
Kbytes, Mbytes or Gbytes respectively
Expert options (these may make the filesystem unmountable):
-nopad do not pad filesystem to a multiple of 4K
-offset <offset> Skip <offset> bytes at the beginning of FILESYSTEM.
Optionally a suffix of K, M or G can be given to specify
Kbytes, Mbytes or Gbytes respectively.
Default 0 bytes
-o <offset> synonym for -offset
Miscellaneous options:
-root-owned alternative name for -all-root
-noInodeCompression alternative name for -noI
-noIdTableCompression alternative name for -noId
-noDataCompression alternative name for -noD
-noFragmentCompression alternative name for -noF
-noXattrCompression alternative name for -noX
-help output this options text to stdout
-h output this options text to stdout
-Xhelp print compressor options for selected compressor
Pseudo file definition format:
"filename d mode uid gid" create a directory
"filename m mode uid gid" modify filename
"filename b mode uid gid major minor" create a block device
"filename c mode uid gid major minor" create a character device
"filename f mode uid gid command" create file from stdout of command
"filename s mode uid gid symlink" create a symbolic link
"filename i mode uid gid [s|f]" create a socket (s) or FIFO (f)
"filename l linkname" create a hard-link to linkname
"filename L pseudo_filename" same, but link to pseudo file
"filename D time mode uid gid" create a directory with timestamp time
"filename M time mode uid gid" modify a file with timestamp time
"filename B time mode uid gid major minor"
create block device with timestamp time
"filename C time mode uid gid major minor"
create char device with timestamp time
"filename F time mode uid gid command" create file with timestamp time
"filename S time mode uid gid symlink" create symlink with timestamp time
"filename I time mode uid gid [s|f]" create socket/fifo with timestamp time
Compressors available and compressor specific options:
gzip (default)
-Xcompression-level <compression-level>
<compression-level> should be 1 .. 9 (default 9)
-Xwindow-size <window-size>
<window-size> should be 8 .. 15 (default 15)
-Xstrategy strategy1,strategy2,...,strategyN
Compress using strategy1,strategy2,...,strategyN in turn
and choose the best compression.
Available strategies: default, filtered, huffman_only,
run_length_encoded and fixed
lzo
-Xalgorithm <algorithm>
Where <algorithm> is one of:
lzo1x_1
lzo1x_1_11
lzo1x_1_12
lzo1x_1_15
lzo1x_999 (default)
-Xcompression-level <compression-level>
<compression-level> should be 1 .. 9 (default 8)
Only applies to lzo1x_999 algorithm
lz4
-Xhc
Compress using LZ4 High Compression
xz
-Xbcj filter1,filter2,...,filterN
Compress using filter1,filter2,...,filterN in turn
(in addition to no filter), and choose the best compression.
Available filters: x86, arm, armthumb, powerpc, sparc, ia64
-Xdict-size <dict-size>
Use <dict-size> as the XZ dictionary size. The dictionary size
can be specified as a percentage of the block size, or as an
absolute value. The dictionary size must be less than or equal
to the block size and 8192 bytes or larger. It must also be
storable in the xz header as either 2^n or as 2^n+2^(n+1).
Example dict-sizes are 75%, 50%, 37.5%, 25%, or 32K, 16K, 8K
etc.
zstd
-Xcompression-level <compression-level>
<compression-level> should be 1 .. 22 (default 15)
lzma
(no options) (deprecated - no kernel support)
Environment:
SOURCE_DATE_EPOCH If set, this is used as the filesystem creation
timestamp. Also any file timestamps which are
after SOURCE_DATE_EPOCH will be clamped to
SOURCE_DATE_EPOCH. See
https://reproducible-builds.org/docs/source-date-epoch/
for more information
See also:
The README for the Squash-tools 4.5.1 release, describing the new features can be
read here https://github.com/plougher/squashfs-tools/blob/master/README-4.5.1
The Squashfs-tools USAGE guide can be read here
https://github.com/plougher/squashfs-tools/blob/master/USAGE
The ACTIONS-README file describing how to use the new actions feature can be
read here https://github.com/plougher/squashfs-tools/blob/master/ACTIONS-README
```
</details>
```
ls -lh /media/benjamin_loison/64XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXd8/SSDServer-squash.img
```
```
-rw-r--r-- 1 benjamin_loison benjamin_loison 84G Sep 12 2022 /media/benjamin_loison/64XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXd8/SSDServer-squash.img
```
```
ls -l /media/benjamin_loison/64XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXd8/SSDServer-squash.img
```
```
-rw-r--r-- 1 benjamin_loison benjamin_loison 89841958912 Sep 12 2022 /media/benjamin_loison/64XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXd8/SSDServer-squash.img
```
```
time sudo mksquashfs /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer{,_squash}.iso
```
<details>
<summary>Output:</summary>
```
Parallel mksquashfs: Using 24 processors
Creating 4.0 filesystem on /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso, block size 131072.
[==========================================================================================================================================================================================|] 1907344/1907344 100%>
Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
compressed data, compressed metadata, compressed fragments,
compressed xattrs, compressed ids
duplicates are removed
Filesystem size 67064143.13 Kbytes (65492.33 Mbytes)
27.47% of uncompressed filesystem size (244147484.63 Kbytes)
Inode table size 2776566 bytes (2711.49 Kbytes)
36.38% of uncompressed inode table size (7631328 bytes)
Directory table size 33 bytes (0.03 Kbytes)
94.29% of uncompressed directory table size (35 bytes)
Number of duplicate files found 0
Number of inodes 2
Number of files 1
Number of fragments 0
Number of symbolic links 0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 1
Number of hard-links 0
Number of ids (unique uids + gids) 1
Number of uids 1
root (0)
Number of gids 1
root (0)
real 25m48.123s
user 0m0.107s
sys 0m0.170s
```
</details>
```
ls -lh /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso
```
```
-rw-r--r-- 1 root root 64G Aug 3 02:25 /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso
```
```
ls -l /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso
```
```
-rw-r--r-- 1 root root 68673683456 Aug 3 02:25 /media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso
```
so it spared 20 GB!
DuckDuckGo search *squashfs writable*.
[The Unix Stack Exchange answer 80312](https://unix.stackexchange.com/a/80312) is inappropriate in my case as recrompressing is an expensive operation.
Related to [Benjamin_Loison/virt-manager/issues/31](https://codeberg.org/Benjamin_Loison/virt-manager/issues/31).
DuckDuckGo search *btrfs compress iso*, *compress iso while keeping writable* and *squashfs writable alternative*.
https://bbs.archlinux.org/viewtopic.php?id=131678
DuckDuckGo and Google search *btrfs compress file* and *Use btrfs like squashfs*.
```
sudo mkfs.ext4 test.iso
```
<details>
<summary>Output:</summary>
```
mke2fs 1.47.0 (5-Feb-2023)
The file test.iso does not exist and no size was specified.
```
</details>
DuckDuckGo and Google search *Linux create ext4 as file*.
[The Unix Stack Exchange question 753111](https://unix.stackexchange.com/q/753111)
```
df -h /
```
<details>
<summary>Output:</summary>
```
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/pegasus--vg-root 731G 554G 141G 80% /
```
</details>
```
fallocate -l 5G test.iso
sudo mkfs.ext4 test.iso
```
<details>
<summary>Output:</summary>
```
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done
Creating filesystem with 1310720 4k blocks and 327680 inodes
Filesystem UUID: 515a90d2-ca70-4939-9292-8f9c4c6fee6e
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
```
</details>
```
df -h /
```
<details>
<summary>Output:</summary>
```
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/pegasus--vg-root 731G 554G 141G 80% /
```
</details>
```
ls -lh test.iso
```
```
-rw-r--r-- 1 benjamin_loison benjamin_loison 5.0G Aug 3 02:45 test.iso
```
```
sudo mkfs.btrfs
```
<details>
<summary>Output:</summary>
```
btrfs-progs v6.2
See http://btrfs.wiki.kernel.org for more information.
usage: mkfs.btrfs [options] <dev> [<dev...>]
Create a BTRFS filesystem on a device or multiple devices
Allocation profiles:
-d|--data PROFILE data profile, raid0, raid1, raid1c3, raid1c4, raid5, raid6, raid10, dup or single
-m|--metadata PROFILE metadata profile, values like for data profile
-M|--mixed mix metadata and data together
Features:
--csum TYPE
--checksum TYPE checksum algorithm to use, crc32c (default), xxhash, sha256, blake2
-n|--nodesize SIZE size of btree nodes
-s|--sectorsize SIZE data block size (may not be mountable by current kernel)
-O|--features LIST comma separated list of filesystem features (use '-O list-all' to list features)
-R|--runtime-features LIST
comma separated list of runtime features (use '-R list-all' to list runtime features)
-L|--label LABEL set the filesystem label
-U|--uuid UUID specify the filesystem UUID (must be unique)
Creation:
-b|--byte-count SIZE set size of each device to SIZE (filesystem size is sum of all device sizes)
-r|--rootdir DIR copy files from DIR to the image root directory
--shrink (with --rootdir) shrink the filled filesystem to minimal size
-K|--nodiscard do not perform whole device TRIM
-f|--force force overwrite of existing filesystem
General:
-q|--quiet no messages except errors
-v|--verbose increase verbosity level, default is 1
-V|--version print the mkfs.btrfs version and exit
--help print this help and exit
Deprecated:
-l|--leafsize SIZE removed in 6.0, use --nodesize
```
</details>
```
file test.iso
```
```
test.iso: Linux rev 1.0 ext4 filesystem data, UUID=167c294b-86f3-41ef-9e16-f89a05e535e5 (extents) (64bit) (large files) (huge files)
```
```
mkdir a/
mount test.iso a/
```
```
mount: a/: failed to setup loop device for /home/benjamin_loison/test.iso.
```
```bash
sudo mount test.iso a/
```
does not return anything.
```
ls -lha a/
```
<details>
<summary>Output:</summary>
```
total 24K
drwxr-xr-x 3 root root 4.0K Aug 3 02:48 .
drwx--x---+ 44 benjamin_loison benjamin_loison 4.0K Aug 3 02:48 ..
drwx------ 2 root root 16K Aug 3 02:48 lost+found
```
</details>
```
umount a/
```
```
umount: /home/benjamin_loison/a: must be superuser to unmount.
```
```
sudo umount a/
```
does not return anything.
```
sudo mkfs.btrfs test.iso
```
<details>
<summary>Output:</summary>
```
btrfs-progs v6.2
See http://btrfs.wiki.kernel.org for more information.
NOTE: several default settings have changed in version 5.15, please make sure
this does not affect your deployments:
- DUP for metadata (-m dup)
- enabled no-holes (-O no-holes)
- enabled free-space-tree (-R free-space-tree)
Label: (null)
UUID: b7095905-987f-444b-af34-573aa57d42cd
Node size: 16384
Sector size: 4096
Filesystem size: 5.00GiB
Block group profiles:
Data: single 8.00MiB
Metadata: DUP 256.00MiB
System: DUP 8.00MiB
SSD detected: no
Zoned device: no
Incompat features: extref, skinny-metadata, no-holes
Runtime features: free-space-tree
Checksum: crc32c
Number of devices: 1
Devices:
ID SIZE PATH
1 5.00GiB test.iso
```
</details>
```
sudo mount test.iso a/
```
does not return anything.
```
ls -lah a/
```
<details>
<summary>Output:</summary>
```
total 20K
drwxr-xr-x 1 root root 0 Aug 3 02:51 .
drwx--x---+ 44 benjamin_loison benjamin_loison 4.0K Aug 3 02:51 ..
```
</details>
DuckDuckGo and Google search *btrfs enable compression*.
https://btrfs.readthedocs.io/en/latest/Compression.html
I suspect that if the compression is at the file level, then modifying the big file, requires to recompress the file.
> Typically the compression can be enabled on the whole filesystem, specified for the mount point.
> The command above will start defragmentation of the whole file and apply the compression, regardless of the mount option.
With ext4:
```
sudo dd if=/dev/urandom of=a/my_data status=progress
```
<details>
<summary>Output:</summary>
```
2017192960 bytes (2.0 GB, 1.9 GiB) copied, 16 s, 126 MB/s^C
4026336+0 records in
4026335+0 records out
2061483520 bytes (2.1 GB, 1.9 GiB) copied, 16.3456 s, 126 MB/s
```
</details>
```
df -h /
```
<details>
<summary>Output:</summary>
```
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/pegasus--vg-root 731G 556G 139G 81% /
```
</details>
so I notice the 2 GB change.
[The Super User answer 1136358](https://superuser.com/a/1136358) may help.
```bash
FILE=/media/benjamin_loison/6aXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXce/SSDServer_squash.iso; dd if=$FILE | pv -s `wc -c $FILE | cut -d ' ' -f 1` | dd of=/media/benjamin_loison/64XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXd8/SSDServer-squash_zerofreed.img
```
<details>
<summary>Output:</summary>
```
134128288+0 records iniB/s] [==================================================================================================================================================================> ] 99% ETA 0:00:00
134128288+0 records out
68673683456 bytes (69 GB, 64 GiB) copied, 1344.43 s, 51.1 MB/s
64.0GiB 0:22:24 [48.7MiB/s] [===================================================================================================================================================================>] 100%
134128288+0 records in
134128288+0 records out
68673683456 bytes (69 GB, 64 GiB) copied, 1343.55 s, 51.1 MB/s
```
</details>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
DuckDuckGo search Linux sparsify disk and Linux replace unused space with zeros.
The Unix Stack Exchange answer 44236 helps.
DuckDuckGo and Google search zerofill squashfs and
"zerofill" "squashfs".Source: Wikipedia: SquashFS (1287034981)
Wikipedia: Comparison_of_file_systems#Block capabilities (1303557071) Deduplication and Compression)
Wikipedia: Comparison of file systems#Allocation and layout policies (1303557071) Sparse files may be relevant
DuckDuckGo and Google search Linux compressed read-write file system, Linux compress iso and dd without zeros.
Output:
Output:
DuckDuckGo search
"dd" "sparse".Output:
Output:
Output:
Output:
DuckDuckGo search zerofree output meaning.
Based on
man14709203 / 61035008 = 24 % are now zero, so can earn at most 256 * 24 / 100 = 61.4 GB.Unclear if modified means where not value to write.
Output:
Output:
so it spared 20 GB!
DuckDuckGo search squashfs writable.
The Unix Stack Exchange answer 80312 is inappropriate in my case as recrompressing is an expensive operation.
Related to Benjamin_Loison/virt-manager/issues/31.
DuckDuckGo search btrfs compress iso, compress iso while keeping writable and squashfs writable alternative.
https://bbs.archlinux.org/viewtopic.php?id=131678
DuckDuckGo and Google search btrfs compress file and Use btrfs like squashfs.
Output:
DuckDuckGo and Google search Linux create ext4 as file.
The Unix Stack Exchange question 753111
Output:
Output:
Output:
Output:
does not return anything.
Output:
does not return anything.
Output:
does not return anything.
Output:
DuckDuckGo and Google search btrfs enable compression.
https://btrfs.readthedocs.io/en/latest/Compression.html
I suspect that if the compression is at the file level, then modifying the big file, requires to recompress the file.
With ext4:
Output:
Output:
so I notice the 2 GB change.
The Super User answer 1136358 may help.
Output:
Related to Benjamin_Loison/coreutils/issues/13.