gnu: gnu-c-manual: Use invoke.
[jackhill/guix/guix.git] / gnu / packages / disk.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2015 Mathieu Lirzin <mthl@gnu.org>
4 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2016, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
8 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
9 ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2017 Hartmut Goebel <h.goebel@crazy-compilers.com>
11 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
12 ;;; Copyright © 2018 Vasile Dumitrascu <va511e@yahoo.com>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages disk)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system trivial)
35 #:use-module (guix build-system python)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages base)
38 #:use-module (gnu packages databases)
39 #:use-module (gnu packages docbook)
40 #:use-module (gnu packages gettext)
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages gtk)
43 #:use-module (gnu packages gnome)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages ncurses)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages popt)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages readline)
51 #:use-module (gnu packages guile)
52 #:use-module (gnu packages compression)
53 #:use-module (gnu packages vim)
54 #:use-module (gnu packages xml))
55
56 (define-public parted
57 (package
58 (name "parted")
59 (version "3.2")
60 (source (origin
61 (method url-fetch)
62 (uri (string-append "mirror://gnu/parted/parted-"
63 version ".tar.xz"))
64 (sha256
65 (base32
66 "1r3qpg3bhz37mgvp9chsaa3k0csby3vayfvz8ggsqz194af5i2w5"))))
67 (build-system gnu-build-system)
68 (arguments
69 `(#:phases
70 (modify-phases %standard-phases
71 (add-after
72 'unpack 'fix-locales-and-python
73 (lambda* (#:key inputs #:allow-other-keys)
74 (substitute* "tests/t0251-gpt-unicode.sh"
75 (("C.UTF-8") "en_US.utf8")) ;not in Glibc locales
76 (substitute* "tests/msdos-overlap"
77 (("/usr/bin/python") (which "python"))))))))
78 (inputs
79 `(("lvm2" ,lvm2)
80 ("readline" ,readline)
81 ("util-linux" ,util-linux)))
82 (native-inputs
83 `(("gettext" ,gettext-minimal)
84 ;; For the tests.
85 ("perl" ,perl)
86 ("python" ,python-2)))
87 (home-page "https://www.gnu.org/software/parted/")
88 (synopsis "Disk partition editor")
89 (description
90 "GNU Parted is a package for creating and manipulating disk partition
91 tables. It includes a library and command-line utility.")
92 (license license:gpl3+)))
93
94 (define-public fdisk
95 (package
96 (name "fdisk")
97 (version "2.0.0a1")
98 (source
99 (origin
100 (method url-fetch)
101 (uri (string-append "mirror://gnu/fdisk/gnufdisk-"
102 version ".tar.gz"))
103 (sha256
104 (base32
105 "1d8za79kw8ihnp2br084rgyjv9whkwp7957rzw815i0izx6xhqy9"))))
106 (build-system gnu-build-system)
107 (inputs
108 `(("gettext" ,gettext-minimal)
109 ("guile" ,guile-1.8)
110 ("util-linux" ,util-linux)
111 ("parted" ,parted)))
112 ;; The build neglects to look for its own headers in its own tree. A next
113 ;; release should fix this, but may never come: GNU fdisk looks abandoned.
114 (arguments
115 `(#:phases
116 (modify-phases %standard-phases
117 (add-after 'unpack 'skip-broken-header-probes
118 (lambda _
119 (substitute* "backend/configure"
120 (("gnufdisk-common.h .*") "\n"))
121 #t)))
122 #:make-flags (list (string-append "CPPFLAGS="
123 " -I../common/include "
124 " -I../debug/include "
125 " -I../exception/include"))))
126 (home-page "https://www.gnu.org/software/fdisk/")
127 (synopsis "Low-level disk partitioning and formatting")
128 (description
129 "GNU fdisk provides a GNU version of the common disk partitioning tool
130 fdisk. fdisk is used for the creation and manipulation of disk partition
131 tables, and it understands a variety of different formats.")
132 (license license:gpl3+)))
133
134 (define-public gptfdisk
135 (package
136 (name "gptfdisk")
137 (version "1.0.3")
138 (source
139 (origin
140 (method url-fetch)
141 (uri (string-append "mirror://sourceforge/gptfdisk/gptfdisk/"
142 version "/" name "-" version ".tar.gz"))
143 (sha256
144 (base32
145 "0p0vr67lnqdsgdv2y144xmjqa1a2nijrrd3clc8dc2f46pn5mzc9"))))
146 (build-system gnu-build-system)
147 (inputs
148 `(("gettext" ,gettext-minimal)
149 ("ncurses" ,ncurses)
150 ("popt" ,popt)
151 ("util-linux" ,util-linux))) ; libuuid
152 (arguments
153 `(#:test-target "test"
154 #:phases
155 (modify-phases %standard-phases
156 ;; no configure script
157 (delete 'configure)
158 ;; no install target
159 (replace 'install
160 (lambda* (#:key outputs #:allow-other-keys)
161 (let* ((out (assoc-ref outputs "out"))
162 (bin (string-append out "/bin"))
163 (man (string-append out "/share/man/man8")))
164 (install-file "gdisk" bin)
165 (install-file "sgdisk" bin)
166 (install-file "cgdisk" bin)
167 (install-file "fixparts" bin)
168 (install-file "cgdisk.8" man)
169 (install-file "fixparts.8" man)
170 (install-file "gdisk.8" man)
171 (install-file "sgdisk.8" man)))))))
172 (home-page "http://www.rodsbooks.com/gdisk/")
173 (synopsis "Low-level GPT disk partitioning and formatting")
174 (description "GPT fdisk (aka gdisk) is a text-mode partitioning tool that
175 works on Globally Unique Identifier (@dfn{GUID}) Partition Table (@dfn{GPT})
176 disks, rather than on the older Master Boot Record (@dfn{MBR}) partition
177 scheme.")
178 (license license:gpl2)))
179
180 (define-public ddrescue
181 (package
182 (name "ddrescue")
183 (version "1.23")
184 (source
185 (origin
186 (method url-fetch)
187 (uri (string-append "mirror://gnu/ddrescue/ddrescue-"
188 version ".tar.lz"))
189 (sha256
190 (base32
191 "13cd6c0x91zq10vdlyl6r5rib47bmsn5sshmkin3igwj8pa2vbm9"))))
192 (build-system gnu-build-system)
193 (home-page "https://www.gnu.org/software/ddrescue/ddrescue.html")
194 (synopsis "Data recovery utility")
195 (native-inputs `(("lzip" ,lzip)))
196 (description
197 "GNU ddrescue is a fully automated data recovery tool. It copies data
198 from one file to another, working to rescue data in case of read errors. The
199 program also includes a tool for manipulating its log files, which are used
200 to recover data more efficiently by only reading the necessary blocks.")
201 (license license:gpl3+)))
202
203 (define-public dosfstools
204 (package
205 (name "dosfstools")
206 (version "4.1")
207 (source
208 (origin
209 (method url-fetch)
210 (uri (string-append "https://github.com/" name "/" name
211 "/releases/download/v" version "/"
212 name "-" version ".tar.xz"))
213 (sha256
214 (base32
215 "0wy13i3i4x2bw1hf5m4fd0myh61f9bcrs035fdlf6gyc1jksrcp6"))))
216 (build-system gnu-build-system)
217 (arguments
218 `(#:make-flags (list (string-append "PREFIX=" %output)
219 "CC=gcc")))
220 (native-inputs
221 `(("xxd" ,xxd))) ; for tests
222 (home-page "https://github.com/dosfstools/dosfstools")
223 (synopsis "Utilities for making and checking MS-DOS FAT file systems")
224 (description
225 "The dosfstools package includes the mkfs.fat and fsck.fat utilities,
226 which respectively make and check MS-DOS FAT file systems.")
227 (license license:gpl3+)))
228
229 (define dosfstools/static
230 (static-package
231 (package (inherit dosfstools))))
232
233 (define-public fatfsck/static
234 (package
235 (name "fatfsck-static")
236 (version (package-version dosfstools))
237 (build-system trivial-build-system)
238 (source #f)
239 (arguments
240 `(#:modules ((guix build utils))
241 #:builder
242 (begin
243 (use-modules (guix build utils))
244 (let ((src (string-append (assoc-ref %build-inputs "dosfstools")
245 "/sbin"))
246 (exe "fsck.fat")
247 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
248 (mkdir-p bin)
249 (with-directory-excursion bin
250 (copy-file (string-append src "/" exe) exe)
251 (remove-store-references exe)
252 (chmod exe #o555)
253 ;; Add fsck.vfat symlink to match the Linux driver name.
254 (symlink exe "fsck.vfat")
255 #t)))))
256 (inputs `(("dosfstools" ,dosfstools/static)))
257 (home-page (package-home-page dosfstools))
258 (synopsis "Statically linked fsck.fat from dosfstools")
259 (description "This package provides a statically-linked @command{fsck.fat}
260 and a @command{fsck.vfat} compatibility symlink for use in an initrd.")
261 (license (package-license dosfstools))))
262
263 (define-public sdparm
264 (package
265 (name "sdparm")
266 (version "1.10")
267 (source
268 (origin
269 (method url-fetch)
270 (uri (string-append "http://sg.danny.cz/sg/p/"
271 name "-" version ".tar.xz"))
272 (sha256
273 (base32
274 "1jjq3lzgfy4r76rc26q02lv4wm5cb4dx5nh913h489zjrr4f3jbx"))))
275 (build-system gnu-build-system)
276 (home-page "http://sg.danny.cz/sg/sdparm.html")
277 (synopsis "Provide access to SCSI device parameters")
278 (description
279 "Sdparm reads and modifies SCSI device parameters. These devices can be
280 SCSI disks, in which case the role of @command{sdparm} is similar to its
281 namesake: the @command{hdparm} utility originally designed for ATA disks.
282 However, @command{sdparm} can be used to access parameters on any device that
283 uses a SCSI command set. Such devices include CD/DVD drives (irrespective of
284 transport), SCSI and ATAPI tape drives, and SCSI enclosures. This utility can
285 also send commands associated with starting and stopping the media, loading
286 and unloading removable media and some other housekeeping functions.")
287 (license license:bsd-3)))
288
289 (define-public idle3-tools
290 (package
291 (name "idle3-tools")
292 (version "0.9.1")
293 (source
294 (origin
295 (method url-fetch)
296 (uri (string-append "mirror://sourceforge/idle3-tools/idle3-tools-"
297 version ".tgz"))
298 (sha256
299 (base32
300 "00ia7xq9yldxyl9gz0mr4xa568nav14p0fnv82f2rbbkg060cy4p"))))
301 (build-system gnu-build-system)
302 (arguments
303 `(#:tests? #f ;no test suite
304 #:phases
305 (modify-phases %standard-phases
306 (delete 'configure))
307 #:make-flags (list "CC=gcc"
308 (string-append "manprefix=")
309 (string-append "DESTDIR="
310 (assoc-ref %outputs "out")))))
311 (home-page "http://idle3-tools.sourceforge.net")
312 (synopsis "Change or disable Western Digital hard drives' Idle3 timer")
313 (description
314 "Idle3-tools provides a utility to get, set, or disable the Idle3 timer
315 present in many Western Digital hard drives. This timer is part of the
316 \"IntelliPark\" feature that stops the disk when not in use. Unfortunately,
317 the default timer setting is not well suited to Linux or other *nix systems,
318 and can dramatically shorten the lifespan of the drive if left unchecked.")
319 (license license:gpl3+)))
320
321 (define-public gparted
322 (package
323 (name "gparted")
324 (version "0.31.0")
325 (source
326 (origin
327 (method url-fetch)
328 (uri (string-append "mirror://sourceforge/gparted/gparted/gparted-"
329 version "/gparted-" version ".tar.gz"))
330 (sha256
331 (base32 "1fh7rpgb4xxdhgyjsirb83zvjfc5mfngb8a1pjbv7r6r6jj4jyrv"))))
332 (build-system gnu-build-system)
333 (arguments
334 `(#:tests? #f ; tests require a network connection
335 #:configure-flags '("--disable-scrollkeeper")))
336 (inputs
337 `(("util-linux" ,util-linux)
338 ("parted" ,parted)
339 ("glib" ,glib)
340 ("gtkmm" ,gtkmm-2)
341 ("libxml2" ,libxml2)
342 ("libxslt" ,libxslt)
343 ("gnome-doc-utils" ,gnome-doc-utils)
344 ("docbook-xml" ,docbook-xml-4.2)
345 ("python" ,python-2)
346 ("python-libxml2" ,python2-libxml2)
347 ("which" ,which)))
348 (native-inputs
349 `(("intltool" ,intltool)
350 ("pkg-config" ,pkg-config)))
351 (home-page "https://gparted.org/")
352 (synopsis "Partition editor to graphically manage disk partitions")
353 (description "GParted is a GNOME partition editor for creating,
354 reorganizing, and deleting disk partitions. It uses libparted from the parted
355 project to detect and manipulate partition tables. Optional file system tools
356 permit managing file systems not included in libparted.")
357 ;; The home page says GPLv2, but the source code says GPLv2+.
358 (license license:gpl2+)))
359
360 (define-public pydf
361 (package
362 (name "pydf")
363 (version "12")
364 (source
365 (origin
366 (method url-fetch)
367 (uri (pypi-uri "pydf" version))
368 (sha256
369 (base32
370 "0f8ly8xyp93i2hm9c0qjqd4y86nz73axw2f09z01mszwmg1sfivz"))))
371 (build-system python-build-system)
372 (home-page "http://kassiopeia.juls.savba.sk/~garabik/software/pydf/")
373 (synopsis "Colourised @command{df} clone")
374 (description "All-singing, all-dancing, fully colourised @command{df} clone
375 written in Python. It displays the amount of disk space available on the
376 mounted file systems, using different colours for different types of file
377 systems. Output format is completely customizable.")
378 (license license:public-domain)))
379
380 (define-public f3
381 (package
382 (name "f3")
383 (version "6.0")
384 (source
385 (origin
386 (method url-fetch)
387 (uri (string-append "https://github.com/AltraMayor/f3/archive/"
388 "v" version ".tar.gz"))
389 (file-name (string-append name "-" version ".tar.gz"))
390 (sha256
391 (base32
392 "1mgbzc1swvgil45md1336j0aqkmkhwmpxical0ln5g09b2qxsanp"))))
393 (build-system gnu-build-system)
394 (arguments
395 '(#:tests? #f ; no check target
396 #:make-flags (list "CC=gcc"
397 (string-append "PREFIX=" %output))
398 #:phases
399 (modify-phases %standard-phases
400 (delete 'configure)
401 (add-before 'build 'fix-makefile
402 (lambda _
403 (substitute* "Makefile"
404 ;; Install without setting owner and group
405 (("\\$\\(INSTALL\\) -oroot -groot ") "$(INSTALL) ")
406 ;; also build and install experimental tools
407 (("^all: ") "all: $(EXPERIMENTAL_TARGETS) ")
408 (("^install: ") "install-all: ")
409 (("^install-experimental: ") "install: install-all "))
410 #t)))))
411 (inputs
412 `(("eudev" ,eudev)
413 ("parted" ,parted)))
414 (home-page "http://oss.digirati.com.br/f3/")
415 (synopsis "Test real capacity of flash memory cards and such.")
416 (description "F3 (Fight Flash Fraud or Fight Fake Flash) tests the full
417 capacity of a flash card (flash drive, flash disk, pendrive). F3 writes to
418 the card and then checks if can read it. It will assure you haven't been sold
419 a card with a smaller capacity than stated.")
420 (license license:gpl3+)))
421
422 (define-public python-parted
423 (package
424 (name "python-parted")
425 (version "3.11.1")
426 (source
427 (origin
428 (method url-fetch)
429 (uri (string-append "https://github.com/dcantrell/pyparted/archive/v"
430 version ".tar.gz"))
431 (sha256
432 (base32
433 "0r1nyjj40nacnfnv17x2mnsj6ga1qplyxyza82v2809dfhim2fwq"))))
434 (build-system python-build-system)
435 (arguments
436 `(#:phases
437 (modify-phases %standard-phases
438 (delete 'check)
439 (add-after 'install 'check
440 (lambda* (#:key outputs inputs #:allow-other-keys)
441 (add-installed-pythonpath inputs outputs)
442 ;; See <https://github.com/dcantrell/pyparted/issues/47>.
443 (substitute* "tests/test__ped_ped.py"
444 (("\"/tmp/temp-device-\"") "self.path"))
445 (invoke "python" "-m" "unittest" "discover" "-v")
446 #t)))))
447 (native-inputs
448 `(("e2fsprogs" ,e2fsprogs)
449 ("pkg-config" ,pkg-config)))
450 (propagated-inputs
451 `(("python-six" ,python-six)))
452 (inputs
453 `(("parted" ,parted)))
454 (home-page "https://github.com/dcantrell/pyparted")
455 (synopsis "Parted bindings for Python")
456 (description "This package provides @code{parted} bindings for Python.")
457 (license license:gpl2+)))
458
459 (define-public python2-parted
460 (package-with-python2 python-parted))
461
462 (define-public duperemove
463 (package
464 (name "duperemove")
465 (version "v0.11.beta4")
466 (source (origin
467 (method url-fetch)
468 (uri (string-append
469 "https://github.com/markfasheh/duperemove/archive/"
470 version ".tar.gz"))
471 (sha256
472 (base32
473 "1h5nk03kflfnzihvn2rvfz1h623x1zpkn9hp29skd7n3f2bc5k7x"))
474 (file-name (string-append name "-" version ".tar.gz"))))
475 (build-system gnu-build-system)
476 (native-inputs
477 `(("pkg-config" ,pkg-config)))
478 (inputs
479 `(("glib" ,glib)
480 ("sqlite" ,sqlite)))
481 (arguments
482 `(#:tests? #f ;no test suite
483 #:phases
484 (modify-phases %standard-phases
485 ;; no configure script
486 (delete 'configure))
487 #:make-flags (list (string-append "PREFIX=" %output)
488 "CC=gcc")))
489 (home-page "https://github.com/markfasheh/duperemove")
490 (synopsis "Tools for de-duplicating file system data")
491 (description "Duperemove is a simple tool for finding duplicated extents
492 and submitting them for deduplication. When given a list of files it will
493 hash their contents on a block by block basis and compare those hashes to each
494 other, finding and categorizing blocks that match each other. When given the
495 @option{-d} option, duperemove will submit those extents for deduplication
496 using the Linux kernel extent-same @code{ioctl}.
497
498 Duperemove can store the hashes it computes in a @dfn{hash file}. If given an
499 existing hash file, duperemove will only compute hashes for those files which
500 have changed since the last run. Thus you can run duperemove repeatedly on
501 your data as it changes, without having to re-checksum unchanged data.
502
503 Duperemove can also take input from the @command{fdupes} program.")
504 (license license:gpl2)))