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>
14 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
62 (uri (string-append "mirror://gnu/parted/parted-"
66 "1r3qpg3bhz37mgvp9chsaa3k0csby3vayfvz8ggsqz194af5i2w5"))))
67 (build-system gnu-build-system)
70 (modify-phases %standard-phases
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"))))))))
80 ("readline" ,readline)
81 ("util-linux" ,util-linux)))
83 `(("gettext" ,gettext-minimal)
86 ("python" ,python-2)))
87 (home-page "https://www.gnu.org/software/parted/")
88 (synopsis "Disk partition editor")
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+)))
101 (uri (string-append "mirror://gnu/fdisk/gnufdisk-"
105 "1d8za79kw8ihnp2br084rgyjv9whkwp7957rzw815i0izx6xhqy9"))))
106 (build-system gnu-build-system)
108 `(("gettext" ,gettext-minimal)
110 ("util-linux" ,util-linux)
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.
116 (modify-phases %standard-phases
117 (add-after 'unpack 'skip-broken-header-probes
119 (substitute* "backend/configure"
120 (("gnufdisk-common.h .*") "\n"))
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")
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+)))
134 (define-public gptfdisk
141 (uri (string-append "mirror://sourceforge/gptfdisk/gptfdisk/"
142 version "/" name "-" version ".tar.gz"))
145 "0p0vr67lnqdsgdv2y144xmjqa1a2nijrrd3clc8dc2f46pn5mzc9"))))
146 (build-system gnu-build-system)
148 `(("gettext" ,gettext-minimal)
151 ("util-linux" ,util-linux))) ; libuuid
153 `(#:test-target "test"
155 (modify-phases %standard-phases
156 ;; no configure script
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
178 (license license:gpl2)))
180 (define-public ddrescue
187 (uri (string-append "mirror://gnu/ddrescue/ddrescue-"
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)))
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+)))
203 (define-public dosfstools
210 (uri (string-append "https://github.com/" name "/" name
211 "/releases/download/v" version "/"
212 name "-" version ".tar.xz"))
215 "0wy13i3i4x2bw1hf5m4fd0myh61f9bcrs035fdlf6gyc1jksrcp6"))))
216 (build-system gnu-build-system)
218 `(#:make-flags (list (string-append "PREFIX=" %output)
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")
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+)))
229 (define dosfstools/static
231 (package (inherit dosfstools))))
233 (define-public fatfsck/static
235 (name "fatfsck-static")
236 (version (package-version dosfstools))
237 (build-system trivial-build-system)
240 `(#:modules ((guix build utils))
243 (use-modules (guix build utils))
244 (let ((src (string-append (assoc-ref %build-inputs "dosfstools")
247 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
249 (with-directory-excursion bin
250 (copy-file (string-append src "/" exe) exe)
251 (remove-store-references exe)
253 ;; Add fsck.vfat symlink to match the Linux driver name.
254 (symlink exe "fsck.vfat")
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))))
263 (define-public sdparm
270 (uri (string-append "http://sg.danny.cz/sg/p/"
271 name "-" version ".tar.xz"))
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")
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)))
289 (define-public idle3-tools
296 (uri (string-append "mirror://sourceforge/idle3-tools/idle3-tools-"
300 "00ia7xq9yldxyl9gz0mr4xa568nav14p0fnv82f2rbbkg060cy4p"))))
301 (build-system gnu-build-system)
303 `(#:tests? #f ;no test suite
305 (modify-phases %standard-phases
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")
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+)))
321 (define-public gparted
328 (uri (string-append "mirror://sourceforge/gparted/gparted/gparted-"
329 version "/gparted-" version ".tar.gz"))
331 (base32 "1fh7rpgb4xxdhgyjsirb83zvjfc5mfngb8a1pjbv7r6r6jj4jyrv"))))
332 (build-system gnu-build-system)
334 `(#:tests? #f ; tests require a network connection
335 #:configure-flags '("--disable-scrollkeeper")))
337 `(("util-linux" ,util-linux)
343 ("gnome-doc-utils" ,gnome-doc-utils)
344 ("docbook-xml" ,docbook-xml-4.2)
346 ("python-libxml2" ,python2-libxml2)
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+)))
367 (uri (pypi-uri "pydf" version))
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)))
387 (uri (string-append "https://github.com/AltraMayor/f3/archive/"
388 "v" version ".tar.gz"))
389 (file-name (string-append name "-" version ".tar.gz"))
392 "1mgbzc1swvgil45md1336j0aqkmkhwmpxical0ln5g09b2qxsanp"))))
393 (build-system gnu-build-system)
395 '(#:tests? #f ; no check target
396 #:make-flags (list "CC=gcc"
397 (string-append "PREFIX=" %output))
399 (modify-phases %standard-phases
401 (add-before 'build 'fix-makefile
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 "))
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+)))
422 (define-public python-parted
424 (name "python-parted")
429 (uri (string-append "https://github.com/dcantrell/pyparted/archive/v"
433 "0r1nyjj40nacnfnv17x2mnsj6ga1qplyxyza82v2809dfhim2fwq"))))
434 (build-system python-build-system)
437 (modify-phases %standard-phases
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")
448 `(("e2fsprogs" ,e2fsprogs)
449 ("pkg-config" ,pkg-config)))
451 `(("python-six" ,python-six)))
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+)))
459 (define-public python2-parted
460 (package-with-python2 python-parted))
462 (define-public duperemove
465 (version "v0.11.beta4")
469 "https://github.com/markfasheh/duperemove/archive/"
473 "1h5nk03kflfnzihvn2rvfz1h623x1zpkn9hp29skd7n3f2bc5k7x"))
474 (file-name (string-append name "-" version ".tar.gz"))))
475 (build-system gnu-build-system)
477 `(("pkg-config" ,pkg-config)))
482 `(#:tests? #f ;no test suite
484 (modify-phases %standard-phases
485 ;; no configure script
487 #:make-flags (list (string-append "PREFIX=" %output)
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}.
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.
503 Duperemove can also take input from the @command{fdupes} program.")
504 (license license:gpl2)))