1FPART(1)                  BSD General Commands Manual                 FPART(1)
2

NAME

4     fpart — Sort and pack files into partitions
5

SYNOPSIS

7     fpart [-h] [-V] -n num | -f files | -s size [-i infile] [-a] [-o outfile]
8           [-0] [-e] [-v] [-l] [-b] [-y pattern] [-Y pattern] [-x pattern]
9           [-X pattern] [-z] [-zz] [-zzz] [-d depth] [-D] [-E] [-L] [-w cmd]
10           [-W cmd] [-p num] [-q num] [-r num] [FILE or DIR...]
11

DESCRIPTION

13     The fpart utility helps you sort file trees and pack them into bags
14     (called "partitions").
15

GENERAL OPTIONS

17     -h      Print help
18
19     -V      Print version
20

PARTITION CONTROL

22     -n num  Create exactly num partitions and try to generate partitions with
23             the same size and number of files.  This option cannot be used in
24             conjunction with -f, -s or -L.
25
26     -f files
27             Create partitions containing at most files files or directories.
28             This option can be used in conjunction with -s and -L.
29
30     -s size
31             Create partitions with a maximum size of size bytes.  With this
32             option, partition 0 may be used to handle files that do not fit
33             in a regular partition, given the provided size limit.  This
34             option can be used in conjunction with -f and -L.  You can use a
35             human-friendly unit suffix here (k, m, g, t, p).
36

INPUT CONTROL

38     -i infile
39             Read file list from infile.  If infile is “-”, then list is read
40             from stdin.
41
42     -a      Input contains arbitrary values; just sort them (do not crawl
43             filesystem).  Input must follow the “size(blank)path” scheme.
44             This option is incompatible with crawling-related options.
45

OUTPUT CONTROL

47     -o outfile
48             Output partitions' contents to outfile template.  Multiple files
49             will be generated given that template.  Each outfile will get
50             partition number as a suffix.  If outfile is “-”, then partitions
51             will be printed to stdout, with partition number used as a prefix
52             (so you can grep partitions you are interested in, or do whatever
53             you want).
54
55     -0      End filenames with a null (’\0’) character when using option -o.
56
57     -e      When adding directories (see DIRECTORY HANDLING ), add an ending
58             “/” to each directory entry.
59
60     -v      Verbose mode (may be specified more than once).
61

FILESYSTEM CRAWLING CONTROL

63     -l      Follow symbolic links (default: do not follow).
64
65     -b      Do not cross filesystem boundaries (default: cross).
66
67     -y pattern
68             Include files or directories matching pattern only (and discard
69             all other files).  This option may be specified several times.
70             Pattern may be a leaf (file or directory) name or a specific
71             path.  Shell pattern matching characters (“[”, “]”, “*”, “?”) may
72             be used.  It does not apply when computing size of directories to
73             be added once a maximum depth (see option -d ) has been reached
74             (in that case, once the maximum depth has been reached, every
75             single file accounts for a directory size).
76
77     -Y pattern
78             Same as -y but case insensitive.  This option may not be avail‐
79             able on your platform (at least FreeBSD and GNU/Linux support it,
80             Solaris does not).
81
82     -x pattern
83             Exclude files or directories matching pattern.  This option can
84             be used in conjunction with -y and -Y.  In this case, exclusion
85             is performed after.  This option may be specified several times.
86             Pattern may be a leaf (file or directory) name or a specific
87             path.  Shell pattern matching characters (“[”, “]”, “*”, “?”) may
88             be used.  It does not apply when computing size of directories to
89             be added once a maximum depth (see option -d ) has been reached
90             (in that case, once the maximum depth has been reached, every
91             single file accounts for a directory size).
92
93     -X pattern
94             Same as -x but case insensitive.  This option may not be avail‐
95             able on your platform (at least FreeBSD and GNU/Linux support it,
96             Solaris does not).
97

DIRECTORY HANDLING

99     -z      Pack empty directories.  By default, fpart will pack files only
100             (except when using the -d or -D options).  This option can be
101             useful for tools such as rsync(1) to be able to recreate a full
102             file tree when used with fpart (e.g. using rsync's --files-from
103             option).  See the -zz option to also pack un-readable directo‐
104             ries.
105
106     -zz     Treat un-readable directories as empty, causing them to be packed
107             anyway.
108
109     -zzz    Pack all directories (as empty).  Useful when 3rd party tools
110             need directory entries to update them (e.g. cpio).
111
112     -d depth
113             After a certain depth, pack directories instead of files (direc‐
114             tories themselves will be added to partitions, instead of their
115             content).  You can force a specific file to be packed anyway by
116             listing it on the command line explicitly.
117
118     -D      Implies -z.  Pack leaf directories: if a directory contains files
119             only, it will be packed as a single entry.  You can force a spe‐
120             cific file to be packed anyway by listing it on the command line
121             explicitly.
122
123     -E      Implies -D.  Pack directories only (work on a per-directory
124             basis): in that mode, no file will be packed.  Instead, each
125             directory will be packed as a single entry with a size being the
126             sum of all top-level files' sizes.  You can force a specific file
127             to be packed anyway by listing it on the command line explicitly.
128

LIVE MODE

130     -L      Live mode (default: disabled).  When using this mode, partitions
131             will be generated while crawling filesystem.  This option saves
132             time and memory, but does not give partition 0 a special meaning
133             (see option -s ).  As a consequence, it can generate partitions
134             larger than the size specified with option -s.  This option can
135             be used in conjunction with options -f and -s, but not with
136             option -n.
137
138     -w cmd  When using live mode, execute cmd when starting a new partition
139             (before having opened next output file, if any).  cmd is run in a
140             specific environment that provides several variables describing
141             the state of the program: FPART_HOOKTYPE ("pre-part" or "post-
142             part"), FPART_PARTFILENAME (current partition's output file
143             name), FPART_PARTNUMBER (current partition number),
144             FPART_PARTSIZE (current partition size), FPART_PARTNUMFILES (num‐
145             ber of files in current partition), FPART_PID (PID of fpart).
146             Note that variables may or may not be defined, depending of
147             requested options and current partition's state when the hook is
148             triggered.  Also, note that hooks are executed in a synchronous
149             way while crawling filesystem, so 1) avoid executing commands
150             that take a long time to return as it slows down filesystem
151             crawling and 2) do not presume cwd (PWD) is the one fpart has
152             been started in, as it is regularly changed to speed up crawling
153             (use absolute paths within hooks).
154
155     -W cmd  Same as -w, but executes cmd when finishing a partition (after
156             having closed last output file, if any).
157

SIZE HANDLING

159     -p num  Preload each partition with num bytes.  You can use a human-
160             friendly unit suffix here (k, m, g, t, p).
161
162     -q num  Overload each file size with num bytes.  You can use a human-
163             friendly unit suffix here (k, m, g, t, p).
164
165     -r num  Round each file size up to next num bytes multiple.  This option
166             can be used in conjunction with overloading, which is done
167             *before* rounding.  You can use a human-friendly unit suffix here
168             (k, m, g, t, p).
169

EXAMPLES

171     Here are some examples:
172
173     fpart -n 3 -o var-parts /var
174             Produce 3 partitions, with (hopefully) the same size and number
175             of files.  Three files: var-parts.0, var-parts.1 and var-parts.2
176             are generated as output.
177
178     fpart -s 4724464025 -o music-parts /path/to/music ./*.mp3
179             Produce partitions of 4.4 GB, containing music files from
180             /path/to/music as well as MP3 files from current directory; with
181             such a partition size, each partition content will be ready to be
182             burnt to a DVD.  Files music-parts.0 to music-parts.n, are gener‐
183             ated as output.
184
185     find /usr ! -type d | fpart -f 10000 -i - /home | grep '^0:'
186             Produce partitions containing 10000 files each by examining /usr
187             first and then /home and display only partition 0 on stdout.
188
189     du * | fpart -n 2 -a
190             Produce two partitions by using du(1) output.  Fpart will not
191             examine the file system but instead use arbitrary values printed
192             by du(1) and sort them.
193

SEE ALSO

195     du(1), find(1), fpsync(1), grep(1), rsync(1)
196

AUTHOR, AVAILABILITY

198     Fpart has been written by Ganaël LAPLANCHE and is available under the BSD
199     license on
200           http://contribs.martymac.org
201

BUGS

203     No bug known (yet).
204
205BSD                            November 18, 2011                           BSD
Impressum