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 ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
14 ;;; Copyright © 2018 Rutger Helling <rhelling@mykolab.com>
15 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
17 ;;; This file is part of GNU Guix.
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32 (define-module (gnu packages disk)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system trivial)
39 #:use-module (guix build-system python)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages base)
42 #:use-module (gnu packages check)
43 #:use-module (gnu packages databases)
44 #:use-module (gnu packages docbook)
45 #:use-module (gnu packages gettext)
46 #:use-module (gnu packages glib)
47 #:use-module (gnu packages gtk)
48 #:use-module (gnu packages gnome)
49 #:use-module (gnu packages linux)
50 #:use-module (gnu packages ncurses)
51 #:use-module (gnu packages perl)
52 #:use-module (gnu packages pkg-config)
53 #:use-module (gnu packages popt)
54 #:use-module (gnu packages python)
55 #:use-module (gnu packages readline)
56 #:use-module (gnu packages guile)
57 #:use-module (gnu packages compression)
58 #:use-module (gnu packages vim)
59 #:use-module (gnu packages w3m)
60 #:use-module (gnu packages xml)
61 #:use-module (gnu packages cryptsetup)
62 #:use-module (gnu packages gnuzilla)
63 #:use-module (gnu packages gnupg)
64 #:use-module (gnu packages swig)
65 #:use-module (gnu packages autotools)
66 #:use-module (gnu packages web)
67 #:use-module (gnu packages documentation)
68 #:use-module (gnu packages bash)
69 #:use-module (gnu packages c))
77 (uri (string-append "mirror://gnu/parted/parted-"
81 "1r3qpg3bhz37mgvp9chsaa3k0csby3vayfvz8ggsqz194af5i2w5"))))
82 (build-system gnu-build-system)
85 (modify-phases %standard-phases
87 'unpack 'fix-locales-and-python
88 (lambda* (#:key inputs #:allow-other-keys)
89 (substitute* "tests/t0251-gpt-unicode.sh"
90 (("C.UTF-8") "en_US.utf8")) ;not in Glibc locales
91 (substitute* "tests/msdos-overlap"
92 (("/usr/bin/python") (which "python"))))))))
95 ("readline" ,readline)
96 ("util-linux" ,util-linux)))
98 `(("gettext" ,gettext-minimal)
101 ("python" ,python-2)))
102 (home-page "https://www.gnu.org/software/parted/")
103 (synopsis "Disk partition editor")
105 "GNU Parted is a package for creating and manipulating disk partition
106 tables. It includes a library and command-line utility.")
107 (license license:gpl3+)))
116 (uri (string-append "mirror://gnu/fdisk/gnufdisk-"
120 "1d8za79kw8ihnp2br084rgyjv9whkwp7957rzw815i0izx6xhqy9"))))
121 (build-system gnu-build-system)
123 `(("gettext" ,gettext-minimal)
125 ("util-linux" ,util-linux)
127 ;; The build neglects to look for its own headers in its own tree. A next
128 ;; release should fix this, but may never come: GNU fdisk looks abandoned.
131 (modify-phases %standard-phases
132 (add-after 'unpack 'skip-broken-header-probes
134 (substitute* "backend/configure"
135 (("gnufdisk-common.h .*") "\n"))
137 #:make-flags (list (string-append "CPPFLAGS="
138 " -I../common/include "
139 " -I../debug/include "
140 " -I../exception/include"))))
141 (home-page "https://www.gnu.org/software/fdisk/")
142 (synopsis "Low-level disk partitioning and formatting")
144 "GNU fdisk provides a GNU version of the common disk partitioning tool
145 fdisk. fdisk is used for the creation and manipulation of disk partition
146 tables, and it understands a variety of different formats.")
147 (license license:gpl3+)))
149 (define-public gptfdisk
156 (uri (string-append "mirror://sourceforge/gptfdisk/gptfdisk/"
157 version "/" name "-" version ".tar.gz"))
160 "13d7gff4prl1nsdknjigmb7bbqhn79165n01v4y9mwbnd0d3jqxn"))))
161 (build-system gnu-build-system)
163 `(("gettext" ,gettext-minimal)
166 ("util-linux" ,util-linux))) ; libuuid
168 `(#:test-target "test"
170 (modify-phases %standard-phases
171 ;; no configure script
175 (lambda* (#:key outputs #:allow-other-keys)
176 (let* ((out (assoc-ref outputs "out"))
177 (bin (string-append out "/bin"))
178 (man (string-append out "/share/man/man8")))
179 (install-file "gdisk" bin)
180 (install-file "sgdisk" bin)
181 (install-file "cgdisk" bin)
182 (install-file "fixparts" bin)
183 (install-file "cgdisk.8" man)
184 (install-file "fixparts.8" man)
185 (install-file "gdisk.8" man)
186 (install-file "sgdisk.8" man)))))))
187 (home-page "http://www.rodsbooks.com/gdisk/")
188 (synopsis "Low-level GPT disk partitioning and formatting")
189 (description "GPT fdisk (aka gdisk) is a text-mode partitioning tool that
190 works on Globally Unique Identifier (@dfn{GUID}) Partition Table (@dfn{GPT})
191 disks, rather than on the older Master Boot Record (@dfn{MBR}) partition
193 (license license:gpl2)))
195 (define-public ddrescue
202 (uri (string-append "mirror://gnu/ddrescue/ddrescue-"
206 "13cd6c0x91zq10vdlyl6r5rib47bmsn5sshmkin3igwj8pa2vbm9"))))
207 (build-system gnu-build-system)
208 (home-page "https://www.gnu.org/software/ddrescue/ddrescue.html")
209 (synopsis "Data recovery utility")
210 (native-inputs `(("lzip" ,lzip)))
212 "GNU ddrescue is a fully automated data recovery tool. It copies data
213 from one file to another, working to rescue data in case of read errors. The
214 program also includes a tool for manipulating its log files, which are used
215 to recover data more efficiently by only reading the necessary blocks.")
216 (license license:gpl3+)))
218 (define-public dosfstools
225 (uri (string-append "https://github.com/" name "/" name
226 "/releases/download/v" version "/"
227 name "-" version ".tar.xz"))
230 "0wy13i3i4x2bw1hf5m4fd0myh61f9bcrs035fdlf6gyc1jksrcp6"))))
231 (build-system gnu-build-system)
233 `(#:make-flags (list (string-append "PREFIX=" %output)
236 `(("xxd" ,xxd))) ; for tests
237 (home-page "https://github.com/dosfstools/dosfstools")
238 (synopsis "Utilities for making and checking MS-DOS FAT file systems")
240 "The dosfstools package includes the mkfs.fat and fsck.fat utilities,
241 which respectively make and check MS-DOS FAT file systems.")
242 (license license:gpl3+)))
244 (define dosfstools/static
246 (package (inherit dosfstools))))
248 (define-public fatfsck/static
250 (name "fatfsck-static")
251 (version (package-version dosfstools))
252 (build-system trivial-build-system)
255 `(#:modules ((guix build utils))
258 (use-modules (guix build utils))
259 (let ((src (string-append (assoc-ref %build-inputs "dosfstools")
262 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
264 (with-directory-excursion bin
265 (copy-file (string-append src "/" exe) exe)
266 (remove-store-references exe)
268 ;; Add fsck.vfat symlink to match the Linux driver name.
269 (symlink exe "fsck.vfat")
271 (inputs `(("dosfstools" ,dosfstools/static)))
272 (home-page (package-home-page dosfstools))
273 (synopsis "Statically linked fsck.fat from dosfstools")
274 (description "This package provides a statically-linked @command{fsck.fat}
275 and a @command{fsck.vfat} compatibility symlink for use in an initrd.")
276 (license (package-license dosfstools))))
278 (define-public sdparm
285 (uri (string-append "http://sg.danny.cz/sg/p/"
286 name "-" version ".tar.xz"))
289 "1jjq3lzgfy4r76rc26q02lv4wm5cb4dx5nh913h489zjrr4f3jbx"))))
290 (build-system gnu-build-system)
291 (home-page "http://sg.danny.cz/sg/sdparm.html")
292 (synopsis "Provide access to SCSI device parameters")
294 "Sdparm reads and modifies SCSI device parameters. These devices can be
295 SCSI disks, in which case the role of @command{sdparm} is similar to its
296 namesake: the @command{hdparm} utility originally designed for ATA disks.
297 However, @command{sdparm} can be used to access parameters on any device that
298 uses a SCSI command set. Such devices include CD/DVD drives (irrespective of
299 transport), SCSI and ATAPI tape drives, and SCSI enclosures. This utility can
300 also send commands associated with starting and stopping the media, loading
301 and unloading removable media and some other housekeeping functions.")
302 (license license:bsd-3)))
304 (define-public idle3-tools
311 (uri (string-append "mirror://sourceforge/idle3-tools/idle3-tools-"
315 "00ia7xq9yldxyl9gz0mr4xa568nav14p0fnv82f2rbbkg060cy4p"))))
316 (build-system gnu-build-system)
318 `(#:tests? #f ;no test suite
320 (modify-phases %standard-phases
322 #:make-flags (list "CC=gcc"
323 (string-append "manprefix=")
324 (string-append "DESTDIR="
325 (assoc-ref %outputs "out")))))
326 (home-page "http://idle3-tools.sourceforge.net")
327 (synopsis "Change or disable Western Digital hard drives' Idle3 timer")
329 "Idle3-tools provides a utility to get, set, or disable the Idle3 timer
330 present in many Western Digital hard drives. This timer is part of the
331 \"IntelliPark\" feature that stops the disk when not in use. Unfortunately,
332 the default timer setting is not well suited to Linux or other *nix systems,
333 and can dramatically shorten the lifespan of the drive if left unchecked.")
334 (license license:gpl3+)))
336 (define-public gparted
343 (uri (string-append "mirror://sourceforge/gparted/gparted/gparted-"
344 version "/gparted-" version ".tar.gz"))
346 (base32 "1fh7rpgb4xxdhgyjsirb83zvjfc5mfngb8a1pjbv7r6r6jj4jyrv"))))
347 (build-system gnu-build-system)
349 `(#:tests? #f ; tests require a network connection
350 #:configure-flags '("--disable-scrollkeeper")))
352 `(("util-linux" ,util-linux)
358 ("gnome-doc-utils" ,gnome-doc-utils)
359 ("docbook-xml" ,docbook-xml-4.2)
361 ("python-libxml2" ,python2-libxml2)
364 `(("intltool" ,intltool)
365 ("pkg-config" ,pkg-config)))
366 (home-page "https://gparted.org/")
367 (synopsis "Partition editor to graphically manage disk partitions")
368 (description "GParted is a GNOME partition editor for creating,
369 reorganizing, and deleting disk partitions. It uses libparted from the parted
370 project to detect and manipulate partition tables. Optional file system tools
371 permit managing file systems not included in libparted.")
372 ;; The home page says GPLv2, but the source code says GPLv2+.
373 (license license:gpl2+)))
382 (uri (pypi-uri "pydf" version))
385 "0f8ly8xyp93i2hm9c0qjqd4y86nz73axw2f09z01mszwmg1sfivz"))))
386 (build-system python-build-system)
387 (home-page "http://kassiopeia.juls.savba.sk/~garabik/software/pydf/")
388 (synopsis "Colourised @command{df} clone")
389 (description "All-singing, all-dancing, fully colourised @command{df} clone
390 written in Python. It displays the amount of disk space available on the
391 mounted file systems, using different colours for different types of file
392 systems. Output format is completely customizable.")
393 (license license:public-domain)))
403 (url "https://github.com/AltraMayor/f3.git")
404 (commit (string-append "v" version))))
405 (file-name (git-file-name name version))
408 "0zglsmz683jg7f9wc6vmgljyg9w87pbnjw5x4w6x02w8233zvjqf"))))
409 (build-system gnu-build-system)
411 '(#:tests? #f ; no check target
412 #:make-flags (list "CC=gcc"
413 (string-append "PREFIX=" %output))
415 (modify-phases %standard-phases
416 (delete 'configure) ; no configure script
417 (add-after 'build 'build-extra
418 (lambda* (#:key make-flags #:allow-other-keys)
419 (apply invoke "make" "extra" make-flags)))
420 (add-after 'build 'install-extra
421 (lambda* (#:key make-flags #:allow-other-keys)
422 (apply invoke "make" "install-extra" make-flags))))))
426 (home-page "http://oss.digirati.com.br/f3/")
427 (synopsis "Test real capacity of flash memory cards and such.")
428 (description "F3 (Fight Flash Fraud or Fight Fake Flash) tests the full
429 capacity of a flash card (flash drive, flash disk, pendrive). F3 writes to
430 the card and then checks if can read it. It will assure you haven't been sold
431 a card with a smaller capacity than stated.")
432 (license license:gpl3+)))
434 (define-public python-parted
436 (name "python-parted")
441 (uri (string-append "https://github.com/dcantrell/pyparted/archive/v"
445 "0r1nyjj40nacnfnv17x2mnsj6ga1qplyxyza82v2809dfhim2fwq"))))
446 (build-system python-build-system)
449 (modify-phases %standard-phases
451 (add-after 'install 'check
452 (lambda* (#:key outputs inputs #:allow-other-keys)
453 (add-installed-pythonpath inputs outputs)
454 ;; See <https://github.com/dcantrell/pyparted/issues/47>.
455 (substitute* "tests/test__ped_ped.py"
456 (("\"/tmp/temp-device-\"") "self.path"))
457 (invoke "python" "-m" "unittest" "discover" "-v")
460 `(("e2fsprogs" ,e2fsprogs)
461 ("pkg-config" ,pkg-config)))
463 `(("python-six" ,python-six)))
465 `(("parted" ,parted)))
466 (home-page "https://github.com/dcantrell/pyparted")
467 (synopsis "Parted bindings for Python")
468 (description "This package provides @code{parted} bindings for Python.")
469 (license license:gpl2+)))
471 (define-public python2-parted
472 (package-with-python2 python-parted))
474 (define-public duperemove
481 "https://github.com/markfasheh/duperemove/archive/v"
485 "0rjmmh42yqw9a5j6sp31cqwxk3s97dsi4xz0wpxpllj7bsp3aiw5"))
486 (file-name (string-append name "-" version ".tar.gz"))))
487 (build-system gnu-build-system)
489 `(("pkg-config" ,pkg-config)))
494 `(#:tests? #f ; no test suite
496 (modify-phases %standard-phases
497 (delete 'configure)) ; no configure script
498 #:make-flags (list (string-append "PREFIX=" %output)
500 (home-page "https://github.com/markfasheh/duperemove")
501 (synopsis "Tools for de-duplicating file system data")
502 (description "Duperemove is a simple tool for finding duplicated extents
503 and submitting them for deduplication. When given a list of files it will
504 hash their contents on a block by block basis and compare those hashes to each
505 other, finding and categorizing blocks that match each other. When given the
506 @option{-d} option, duperemove will submit those extents for deduplication
507 using the Linux kernel extent-same @code{ioctl}.
509 Duperemove can store the hashes it computes in a @dfn{hash file}. If given an
510 existing hash file, duperemove will only compute hashes for those files which
511 have changed since the last run. Thus you can run duperemove repeatedly on
512 your data as it changes, without having to re-checksum unchanged data.
514 Duperemove can also take input from the @command{fdupes} program.")
515 (license license:gpl2)))
517 (define-public ranger
523 (uri (string-append "https://ranger.github.io/"
524 "ranger-" version ".tar.gz"))
527 "1lnzkrxcnlwnyi3z0v8ybyp8d5rm26qm35rr68kbs2lbs06inha0"))))
528 (build-system python-build-system)
531 (native-inputs ;for tests
532 `(("python-pytest" ,python-pytest)
533 ("python-pylint" ,python-pylint)
534 ("python-flake8" ,python-flake8)
537 '(#:test-target "test"
539 (modify-phases %standard-phases
540 (add-after 'configure 'wrap-program
541 ;; Tell 'ranger' where 'w3mimgdisplay' is.
542 (lambda* (#:key inputs outputs #:allow-other-keys)
543 (let* ((out (assoc-ref outputs "out"))
544 (ranger (string-append out "/bin/ranger"))
545 (w3m (assoc-ref inputs "w3m"))
546 (w3mimgdisplay (string-append w3m
547 "/libexec/w3m/w3mimgdisplay")))
549 `("W3MIMGDISPLAY_PATH" ":" prefix (,w3mimgdisplay)))
551 (home-page "https://ranger.github.io/")
552 (synopsis "Console file manager")
553 (description "ranger is a console file manager with Vi key bindings. It
554 provides a minimalistic and nice curses interface with a view on the directory
555 hierarchy. It ships with @code{rifle}, a file launcher that is good at
556 automatically finding out which program to use for what file type.")
557 (license license:gpl3)))
559 (define-public volume-key
565 (uri (string-append "https://releases.pagure.org/volume_key/volume_key-"
569 "0vaz15rcgdkh5z4yxc22x76wi44gh50jxnrqz5avaxz4bb17kcp6"))))
570 (build-system gnu-build-system)
572 `(("pkg-config" ,pkg-config)
573 ("util-linux" ,util-linux)
575 ("python" ,python-3))) ; Used to generate the Python bindings.
577 `(("cryptsetup" ,cryptsetup)
579 ("lvm2" ,lvm2) ; For "-ldevmapper".
583 `(#:tests? #f ; Not sure how tests are supposed to pass, even when run manually.
585 (modify-phases %standard-phases
586 (add-before 'configure 'patch-python.h-path
587 (lambda* (#:key inputs #:allow-other-keys)
588 (let ((python (assoc-ref inputs "python")))
589 (substitute* "Makefile.in"
590 (("/usr/include/python") (string-append python "/include/python")))
592 (home-page "https://pagure.io/volume_key")
593 (synopsis "Manipulate storage volume encryption keys")
595 "This package provides a library for manipulating storage volume
596 encryption keys and storing them separately from volumes to handle forgotten
598 (license license:gpl2)))
607 (url "https://github.com/pmem/ndctl")
608 (commit (string-append "v" version))))
609 (file-name (string-append name "-" version "-checkout"))
612 "0vid78jzhmzh505bpwn8mvlamfhcvl6rlfjc29y4yn7zslpydxl7"))))
613 (build-system gnu-build-system)
615 `(("asciidoc" ,asciidoc)
616 ("automake" ,automake)
617 ("autoconf" ,autoconf)
618 ("docbook-xsl" ,docbook-xsl)
621 ("pkg-config" ,pkg-config)
623 ;; Required for offline docbook generation:
629 ("util-linux" ,util-linux)))
632 (modify-phases %standard-phases
633 (add-after 'unpack 'autogen
635 (substitute* "autogen.sh"
636 (("/bin/sh") (which "sh")))
637 (substitute* "git-version-gen"
638 (("/bin/sh") (which "sh")))
639 (substitute* "git-version"
640 (("/bin/bash") (which "bash"))))))
642 (let ((out (assoc-ref %outputs "out")))
643 (list (string-append "BASH_COMPLETION_DIR=" out
644 "/share/bash-completion/completions")))))
645 (home-page "https://github.com/pmem/ndctl")
646 (synopsis "Manage the non-volatile memory device sub-system in the Linux kernel")
648 "This package provides a utility library for managing the
649 libnvdimm (non-volatile memory device) sub-system in the Linux kernel.")
650 ;; COPYING says LGPL2.1, but many source files are GPL2 so that's
651 ;; the effective license. Note that some files under ccan/ are
652 ;; covered by BSD-3 or public domain, see the individual folders.
653 (license license:gpl2)))
655 (define-public dmraid
658 (version "1.0.0.rc16-3")
661 (uri (string-append "https://people.redhat.com/~heinzm/sw/dmraid/src/dmraid-"
665 "1n7vsqvh7y6yvil682q129d21yhb0cmvd5fvsbkza7ypd78inhlk"))))
666 (build-system gnu-build-system)
667 (inputs `(("lvm2" ,lvm2)))
668 (native-inputs `(("which" ,which)))
670 `(#:tests? #f ; No tests.
671 ;; Prevent a race condition where some target would attempt to link
672 ;; libdmraid.so before it had been built as reported in
673 ;; <https://bugs.gnu.org/31999#187>.
675 #:phases (modify-phases %standard-phases
676 (add-before 'configure 'change-directory
678 (chdir (string-append ,version "/dmraid"))
679 (substitute* "make.tmpl.in"
680 (("/bin/sh") (which "sh")))
682 #:configure-flags (list ;; Make sure programs such as 'dmevent_tool' can
683 ;; find libdmraid.so.
684 (string-append "LDFLAGS=-Wl,-rpath="
685 (assoc-ref %outputs "out")
687 (home-page "https://people.redhat.com/~heinzm/sw/dmraid/")
688 (synopsis "Device mapper RAID interface")
690 "This software supports RAID device discovery, RAID set activation, creation,
691 removal, rebuild and display of properties for ATARAID/DDF1 metadata.
693 @command{dmraid} uses @file{libdevmapper} and the device-mapper kernel runtime
694 to create devices with respective mappings for the ATARAID sets discovered.")
695 (license license:gpl2+)))
697 (define-public libblockdev
703 (uri (string-append "https://github.com/storaged-project/libblockdev/releases/download/"
704 version "-1/libblockdev-" version ".tar.gz"))
707 "1a3kpdr9s6g7nfibazi92i27wbv692b5gm2r24gimis6l6jq4pbh"))))
708 (build-system gnu-build-system)
710 `(("pkg-config" ,pkg-config)
711 ("python" ,python-wrapper)
712 ("util-linux" ,util-linux)))
714 `(("btrfs-progs" ,btrfs-progs)
715 ("cryptsetup" ,cryptsetup)
716 ("dosfstools" ,dosfstools)
720 ("gobject-introspection" ,gobject-introspection)
722 ("libbytesize" ,libbytesize)
729 ("volume-key" ,volume-key)
730 ;; ("xfsprogs" ,xfsprogs) ; TODO: Package?
732 (home-page "https://github.com/storaged-project/libblockdev")
733 (synopsis "Library for manipulating block devices")
735 "libblockdev is a C library supporting GObject introspection for
736 manipulation of block devices. It has a plugin-based architecture where each
737 technology (like LVM, Btrfs, MD RAID, Swap...) is implemented in a separate
738 plugin, possibly with multiple implementations (e.g. using LVM CLI or the new
740 ;; XXX: Copying says LGPL2.1, but the source files with license
741 ;; information are GPL2+.
742 (license license:gpl2+)))