remap-badblocks 0.8__tar.gz → 0.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. remap_badblocks-0.8.1/PKG-INFO +107 -0
  2. remap_badblocks-0.8.1/README.md +86 -0
  3. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/pyproject.toml +1 -1
  4. remap_badblocks-0.8.1/remap_badblocks.egg-info/PKG-INFO +107 -0
  5. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/__init__.py +1 -1
  6. remap_badblocks-0.8/PKG-INFO +0 -130
  7. remap_badblocks-0.8/README.md +0 -109
  8. remap_badblocks-0.8/remap_badblocks.egg-info/PKG-INFO +0 -130
  9. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/LICENSE +0 -0
  10. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/remap_badblocks.egg-info/SOURCES.txt +0 -0
  11. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/remap_badblocks.egg-info/dependency_links.txt +0 -0
  12. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/remap_badblocks.egg-info/entry_points.txt +0 -0
  13. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/remap_badblocks.egg-info/requires.txt +0 -0
  14. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/remap_badblocks.egg-info/top_level.txt +0 -0
  15. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/setup.cfg +0 -0
  16. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/cli/__init__.py +0 -0
  17. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/cli/__main__.py +0 -0
  18. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/cli/commands/__init__.py +0 -0
  19. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/cli/commands/add.py +0 -0
  20. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/cli/commands/apply.py +0 -0
  21. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/cli/commands/get.py +0 -0
  22. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/cli/commands/remove.py +0 -0
  23. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/cli/commands/update.py +0 -0
  24. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/cli/commands/version.py +0 -0
  25. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/badblocks/_compute_good_ranges.py +0 -0
  26. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/badblocks/_find_badblocks.py +0 -0
  27. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/badblocks/_mapping_generation.py +0 -0
  28. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/badblocks/_remap_badblocks.py +0 -0
  29. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/badblocks/badblocks.py +0 -0
  30. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/devices/__init__.py +0 -0
  31. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/devices/device_config.py +0 -0
  32. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/devices/devices_config.py +0 -0
  33. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/devices/exceptions.py +0 -0
  34. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/devices_config_constants.py +0 -0
  35. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/mapping.py +0 -0
  36. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/remappers/_check_applied_devices.py +0 -0
  37. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/remappers/_generate_dm_table.py +0 -0
  38. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/test_utils.py +0 -0
  39. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/utils/__init__.py +0 -0
  40. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/utils/_get_device_info.py +0 -0
  41. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/utils/_iterable_bytes_converter.py +0 -0
  42. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/utils/_parse_inputs.py +0 -0
  43. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/utils/_run_command.py +0 -0
  44. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/src/remap_badblocks/src/utils/_sort_devices.py +0 -0
  45. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/tests/test_compute_good_ranges.py +0 -0
  46. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/tests/test_devices_config.py +0 -0
  47. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/tests/test_dm_table.py +0 -0
  48. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/tests/test_find_badblocks.py +0 -0
  49. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/tests/test_parse_inputs.py +0 -0
  50. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/tests/test_pyproject_version.py +0 -0
  51. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/tests/test_remap_badblocks.py +0 -0
  52. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/tests/test_run_command.py +0 -0
  53. {remap_badblocks-0.8 → remap_badblocks-0.8.1}/tests/test_sort_devices.py +0 -0
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: remap_badblocks
3
+ Version: 0.8.1
4
+ Summary: CLI tool for remapping bad sectors on Linux disks using device-mapper
5
+ Author-email: Luigi Privitera <priviteraluigi98@gmail.com>
6
+ License-Expression: GPL-3.0-only
7
+ Project-URL: Repository, https://gitlab.com/Luigi-98/remap_badblocks.git
8
+ Project-URL: Issues, https://gitlab.com/Luigi-98/remap_badblocks/-/issues
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Provides-Extra: dev
13
+ Requires-Dist: mypy; extra == "dev"
14
+ Requires-Dist: flake8; extra == "dev"
15
+ Requires-Dist: ruff; extra == "dev"
16
+ Requires-Dist: pytest>=7.0; extra == "dev"
17
+ Requires-Dist: pre-commit; extra == "dev"
18
+ Requires-Dist: black; extra == "dev"
19
+ Requires-Dist: isort; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # remap-badblocks
23
+
24
+ `remap-badblocks` is a Linux CLI tool written in Python that scans a block device for bad sectors and creates a device-mapper target that skips over them. It can also reserve extra space to dynamically remap future badblocks.
25
+
26
+ It's a simple way to extend the usefulness of slightly damaged drives, ideal for anyone who wants to avoid discarding a disk due to a few bad sectors.
27
+
28
+ ## Features
29
+
30
+ * Scans disks using `badblocks` to identify damaged sectors
31
+ * Creates a `device-mapper` target that avoids bad sectors
32
+ * Reserves spare sectors for dynamic remapping
33
+ * Supports using only part of a device (e.g., for hard partitioning or isolation)
34
+
35
+ ## Installation
36
+
37
+ ### From PyPI
38
+
39
+ ```bash
40
+ pip install remap-badblocks
41
+ ```
42
+
43
+ ### From source
44
+
45
+ ```bash
46
+ git clone https://gitlab.com/Luigi-98/remap-badblocks.git
47
+ cd remap-badblocks
48
+ pip install -e .[dev]
49
+ ```
50
+
51
+ ## Usage
52
+
53
+ ### Database
54
+
55
+ `remap-badblocks` relies on a single source of stateful storage: a SQLite database. By default, it is stored at `/etc/remap_badblocks/devices_config.db`, but you can specify an alternative location using the `-P` option.
56
+
57
+ ### Device Identification
58
+
59
+ Devices can be referenced by either:
60
+
61
+ * **Name**: set at creation, used as the name of the output device-mapper
62
+ * **ID**: an internal remap-badblocks identifier
63
+
64
+ ### CLI Reference
65
+
66
+ ```bash
67
+ remap-badblocks --help
68
+ ```
69
+
70
+ ### Example Workflow
71
+
72
+ ```bash
73
+ # Add a new device
74
+ remap-badblocks add my_remapped_device --path /dev/sda
75
+
76
+ # Run a read-mode scan and initialize the mapping
77
+ # by reserving spare space
78
+ remap-badblocks update --name my_remapped_device --mode read --spare-space 100MB
79
+
80
+ # Apply changes to generate the device-mapper
81
+ remap-badblocks apply
82
+
83
+ # Resulting device appears under /dev/mapper
84
+ ls /dev/mapper/
85
+ # /dev/mapper/my_remapped_device
86
+ ```
87
+
88
+ ## Contributing
89
+
90
+ We welcome feedback, bug reports, feature ideas, code contributions, and help shaping the roadmap — or even rethinking the project from the ground up.
91
+
92
+ Start with [CONTRIBUTING.md](./CONTRIBUTING.md), then open an issue or submit a merge request to get involved.
93
+
94
+ ## License
95
+
96
+ GPL v3 License — see [LICENSE](./LICENSE) for details.
97
+
98
+ ## Community
99
+
100
+ * GitLab: [remap-badblocks project page](https://gitlab.com/Luigi-98/remap_badblocks)
101
+ * PyPI: [remap-badblocks](https://pypi.org/project/remap-badblocks/)
102
+ * Issues: [remap-badblocks Gitlab issues](https://gitlab.com/Luigi-98/remap_badblocks/-/issues)
103
+
104
+ ## Acknowledgements & Related Tools
105
+
106
+ * [`badblocks`](https://linux.die.net/man/8/badblocks)
107
+ * [`device-mapper`](https://linux.die.net/man/8/dmsetup)
@@ -0,0 +1,86 @@
1
+ # remap-badblocks
2
+
3
+ `remap-badblocks` is a Linux CLI tool written in Python that scans a block device for bad sectors and creates a device-mapper target that skips over them. It can also reserve extra space to dynamically remap future badblocks.
4
+
5
+ It's a simple way to extend the usefulness of slightly damaged drives, ideal for anyone who wants to avoid discarding a disk due to a few bad sectors.
6
+
7
+ ## Features
8
+
9
+ * Scans disks using `badblocks` to identify damaged sectors
10
+ * Creates a `device-mapper` target that avoids bad sectors
11
+ * Reserves spare sectors for dynamic remapping
12
+ * Supports using only part of a device (e.g., for hard partitioning or isolation)
13
+
14
+ ## Installation
15
+
16
+ ### From PyPI
17
+
18
+ ```bash
19
+ pip install remap-badblocks
20
+ ```
21
+
22
+ ### From source
23
+
24
+ ```bash
25
+ git clone https://gitlab.com/Luigi-98/remap-badblocks.git
26
+ cd remap-badblocks
27
+ pip install -e .[dev]
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ### Database
33
+
34
+ `remap-badblocks` relies on a single source of stateful storage: a SQLite database. By default, it is stored at `/etc/remap_badblocks/devices_config.db`, but you can specify an alternative location using the `-P` option.
35
+
36
+ ### Device Identification
37
+
38
+ Devices can be referenced by either:
39
+
40
+ * **Name**: set at creation, used as the name of the output device-mapper
41
+ * **ID**: an internal remap-badblocks identifier
42
+
43
+ ### CLI Reference
44
+
45
+ ```bash
46
+ remap-badblocks --help
47
+ ```
48
+
49
+ ### Example Workflow
50
+
51
+ ```bash
52
+ # Add a new device
53
+ remap-badblocks add my_remapped_device --path /dev/sda
54
+
55
+ # Run a read-mode scan and initialize the mapping
56
+ # by reserving spare space
57
+ remap-badblocks update --name my_remapped_device --mode read --spare-space 100MB
58
+
59
+ # Apply changes to generate the device-mapper
60
+ remap-badblocks apply
61
+
62
+ # Resulting device appears under /dev/mapper
63
+ ls /dev/mapper/
64
+ # /dev/mapper/my_remapped_device
65
+ ```
66
+
67
+ ## Contributing
68
+
69
+ We welcome feedback, bug reports, feature ideas, code contributions, and help shaping the roadmap — or even rethinking the project from the ground up.
70
+
71
+ Start with [CONTRIBUTING.md](./CONTRIBUTING.md), then open an issue or submit a merge request to get involved.
72
+
73
+ ## License
74
+
75
+ GPL v3 License — see [LICENSE](./LICENSE) for details.
76
+
77
+ ## Community
78
+
79
+ * GitLab: [remap-badblocks project page](https://gitlab.com/Luigi-98/remap_badblocks)
80
+ * PyPI: [remap-badblocks](https://pypi.org/project/remap-badblocks/)
81
+ * Issues: [remap-badblocks Gitlab issues](https://gitlab.com/Luigi-98/remap_badblocks/-/issues)
82
+
83
+ ## Acknowledgements & Related Tools
84
+
85
+ * [`badblocks`](https://linux.die.net/man/8/badblocks)
86
+ * [`device-mapper`](https://linux.die.net/man/8/dmsetup)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "remap_badblocks"
7
- version = "0.8"
7
+ version = "0.8.1"
8
8
  requires-python = ">= 3.10"
9
9
  description = "CLI tool for remapping bad sectors on Linux disks using device-mapper"
10
10
  readme = "README.md"
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: remap_badblocks
3
+ Version: 0.8.1
4
+ Summary: CLI tool for remapping bad sectors on Linux disks using device-mapper
5
+ Author-email: Luigi Privitera <priviteraluigi98@gmail.com>
6
+ License-Expression: GPL-3.0-only
7
+ Project-URL: Repository, https://gitlab.com/Luigi-98/remap_badblocks.git
8
+ Project-URL: Issues, https://gitlab.com/Luigi-98/remap_badblocks/-/issues
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Provides-Extra: dev
13
+ Requires-Dist: mypy; extra == "dev"
14
+ Requires-Dist: flake8; extra == "dev"
15
+ Requires-Dist: ruff; extra == "dev"
16
+ Requires-Dist: pytest>=7.0; extra == "dev"
17
+ Requires-Dist: pre-commit; extra == "dev"
18
+ Requires-Dist: black; extra == "dev"
19
+ Requires-Dist: isort; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # remap-badblocks
23
+
24
+ `remap-badblocks` is a Linux CLI tool written in Python that scans a block device for bad sectors and creates a device-mapper target that skips over them. It can also reserve extra space to dynamically remap future badblocks.
25
+
26
+ It's a simple way to extend the usefulness of slightly damaged drives, ideal for anyone who wants to avoid discarding a disk due to a few bad sectors.
27
+
28
+ ## Features
29
+
30
+ * Scans disks using `badblocks` to identify damaged sectors
31
+ * Creates a `device-mapper` target that avoids bad sectors
32
+ * Reserves spare sectors for dynamic remapping
33
+ * Supports using only part of a device (e.g., for hard partitioning or isolation)
34
+
35
+ ## Installation
36
+
37
+ ### From PyPI
38
+
39
+ ```bash
40
+ pip install remap-badblocks
41
+ ```
42
+
43
+ ### From source
44
+
45
+ ```bash
46
+ git clone https://gitlab.com/Luigi-98/remap-badblocks.git
47
+ cd remap-badblocks
48
+ pip install -e .[dev]
49
+ ```
50
+
51
+ ## Usage
52
+
53
+ ### Database
54
+
55
+ `remap-badblocks` relies on a single source of stateful storage: a SQLite database. By default, it is stored at `/etc/remap_badblocks/devices_config.db`, but you can specify an alternative location using the `-P` option.
56
+
57
+ ### Device Identification
58
+
59
+ Devices can be referenced by either:
60
+
61
+ * **Name**: set at creation, used as the name of the output device-mapper
62
+ * **ID**: an internal remap-badblocks identifier
63
+
64
+ ### CLI Reference
65
+
66
+ ```bash
67
+ remap-badblocks --help
68
+ ```
69
+
70
+ ### Example Workflow
71
+
72
+ ```bash
73
+ # Add a new device
74
+ remap-badblocks add my_remapped_device --path /dev/sda
75
+
76
+ # Run a read-mode scan and initialize the mapping
77
+ # by reserving spare space
78
+ remap-badblocks update --name my_remapped_device --mode read --spare-space 100MB
79
+
80
+ # Apply changes to generate the device-mapper
81
+ remap-badblocks apply
82
+
83
+ # Resulting device appears under /dev/mapper
84
+ ls /dev/mapper/
85
+ # /dev/mapper/my_remapped_device
86
+ ```
87
+
88
+ ## Contributing
89
+
90
+ We welcome feedback, bug reports, feature ideas, code contributions, and help shaping the roadmap — or even rethinking the project from the ground up.
91
+
92
+ Start with [CONTRIBUTING.md](./CONTRIBUTING.md), then open an issue or submit a merge request to get involved.
93
+
94
+ ## License
95
+
96
+ GPL v3 License — see [LICENSE](./LICENSE) for details.
97
+
98
+ ## Community
99
+
100
+ * GitLab: [remap-badblocks project page](https://gitlab.com/Luigi-98/remap_badblocks)
101
+ * PyPI: [remap-badblocks](https://pypi.org/project/remap-badblocks/)
102
+ * Issues: [remap-badblocks Gitlab issues](https://gitlab.com/Luigi-98/remap_badblocks/-/issues)
103
+
104
+ ## Acknowledgements & Related Tools
105
+
106
+ * [`badblocks`](https://linux.die.net/man/8/badblocks)
107
+ * [`device-mapper`](https://linux.die.net/man/8/dmsetup)
@@ -1,3 +1,3 @@
1
1
  from packaging.version import Version
2
2
 
3
- __version__ = Version("0.8")
3
+ __version__ = Version("0.8.1")
@@ -1,130 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: remap_badblocks
3
- Version: 0.8
4
- Summary: CLI tool for remapping bad sectors on Linux disks using device-mapper
5
- Author-email: Luigi Privitera <priviteraluigi98@gmail.com>
6
- License-Expression: GPL-3.0-only
7
- Project-URL: Repository, https://gitlab.com/Luigi-98/remap_badblocks.git
8
- Project-URL: Issues, https://gitlab.com/Luigi-98/remap_badblocks/-/issues
9
- Requires-Python: >=3.10
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Provides-Extra: dev
13
- Requires-Dist: mypy; extra == "dev"
14
- Requires-Dist: flake8; extra == "dev"
15
- Requires-Dist: ruff; extra == "dev"
16
- Requires-Dist: pytest>=7.0; extra == "dev"
17
- Requires-Dist: pre-commit; extra == "dev"
18
- Requires-Dist: black; extra == "dev"
19
- Requires-Dist: isort; extra == "dev"
20
- Dynamic: license-file
21
-
22
- # remap\_badblocks
23
-
24
- `remap_badblocks` is a Linux utility that lets you safely create a virtual block device which skips bad sectors and transparently remaps new bad sectors to healthy spare sectors elsewhere on the same disk. It is useful for squeezing safe, stable usage out of partially failing disks.
25
-
26
- ## 🔧 How It Works
27
-
28
- * Stores devices configurations in a persistent database (this is crucial for accessing the remapped disks)
29
- * badblocks
30
- * mapping between real and virtual blocks
31
- * number of spare sectors in the device
32
- * It can either create a new mapping from scratch or update the existing one to remap new badblocks by keeping everything intact
33
- * It can generate device-mapper devices that follow the stored mappings
34
-
35
- ## 🚀 Usage
36
-
37
- ```bash
38
- remap-badblocks [-h] [-P DB_PATH] {add,get,update,apply} ...
39
- ```
40
-
41
- ### Global Options
42
-
43
- * `-P, --db-path` — path to the configuration database (default is internal)
44
-
45
- ### Commands:
46
-
47
- #### `add`
48
-
49
- Register a new device in the remap database.
50
-
51
- ```bash
52
- remap-badblocks add [--wwn WWN] [--path PATH] name
53
- ```
54
-
55
- * `name`: required alias for the device
56
- * `--wwn`: optional WWN of the device
57
- * `--path`: optional device path (e.g., `/dev/sdX`)
58
-
59
- #### `get`
60
-
61
- Retrieve registered devices or a specific one:
62
-
63
- ```bash
64
- remap-badblocks get [--id ID]
65
- ```
66
-
67
- #### `update`
68
-
69
- Compute and store badblocks, update the mapping:
70
-
71
- ```bash
72
- remap-badblocks update [--mode {read,write,skip}] [--block-range RANGE] [--output OUTPUT] [--spare-space N] id
73
- ```
74
-
75
- * `--mode`: how badblocks should operate (default: `read`)
76
- * `--block-range`: e.g., `0-100000` or `1573-`
77
- * `--output`: also save badblocks to a file
78
- * `--spare-space`: reserve N good sectors for future remapping
79
-
80
- #### `apply`
81
-
82
- Apply the device-mapper table to create a virtual remapped device:
83
-
84
- ```bash
85
- remap-badblocks apply [--id ID] [--method device-mapper]
86
- ```
87
-
88
- ## 🛠️ Example Workflow
89
-
90
- 1. Register the device:
91
-
92
- ```bash
93
- remap-badblocks add --path /dev/disk/by-id/myid mydrive
94
- ```
95
-
96
- 2. Run badblocks scan and create the mapping:
97
-
98
- ```bash
99
- remap-badblocks update --mode read --spare-space 512MB --id 1
100
- ```
101
-
102
- 3. Apply the remapping to create a safe virtual block device:
103
-
104
- ```bash
105
- remap-badblocks apply --id 1
106
- ```
107
-
108
- 4. Use `/dev/mapper/mydrive` as your new clean device
109
-
110
- ## ⚠️ Warnings
111
-
112
- * This tool **does not recover corrupted data**, it only prevents future reads/writes from known bad sectors.
113
- * Only usable on non-boot drives.
114
- * Always keep backups.
115
- * Devices are not persistent between boots, you have to manually apply them at startup (`remap-badblocks apply`), but this will be changed in the future.
116
-
117
- ## 📆 Future Plans
118
-
119
- ### Done
120
- - [x] Manage dependencies between different devices
121
- - [x] Empty db column for "apply at startup"
122
- - [x] Leave free space in disks for possible future metadata (around 4-8B per badblock + 12-24B per mapping, let's consider around 1k badblocks + 1k mappings = 16-32kB => maybe 100kB is good)
123
- - [x] Check already applied devices
124
- - [x] Add version option for getting version
125
-
126
- ## 🤝 Contributions Welcome
127
-
128
- Feel free to submit improvements or suggestions.
129
-
130
- For issues or feature requests, please [open a card on GitLab](https://gitlab.com/Luigi-98/remap_badblocks/-/issues).
@@ -1,109 +0,0 @@
1
- # remap\_badblocks
2
-
3
- `remap_badblocks` is a Linux utility that lets you safely create a virtual block device which skips bad sectors and transparently remaps new bad sectors to healthy spare sectors elsewhere on the same disk. It is useful for squeezing safe, stable usage out of partially failing disks.
4
-
5
- ## 🔧 How It Works
6
-
7
- * Stores devices configurations in a persistent database (this is crucial for accessing the remapped disks)
8
- * badblocks
9
- * mapping between real and virtual blocks
10
- * number of spare sectors in the device
11
- * It can either create a new mapping from scratch or update the existing one to remap new badblocks by keeping everything intact
12
- * It can generate device-mapper devices that follow the stored mappings
13
-
14
- ## 🚀 Usage
15
-
16
- ```bash
17
- remap-badblocks [-h] [-P DB_PATH] {add,get,update,apply} ...
18
- ```
19
-
20
- ### Global Options
21
-
22
- * `-P, --db-path` — path to the configuration database (default is internal)
23
-
24
- ### Commands:
25
-
26
- #### `add`
27
-
28
- Register a new device in the remap database.
29
-
30
- ```bash
31
- remap-badblocks add [--wwn WWN] [--path PATH] name
32
- ```
33
-
34
- * `name`: required alias for the device
35
- * `--wwn`: optional WWN of the device
36
- * `--path`: optional device path (e.g., `/dev/sdX`)
37
-
38
- #### `get`
39
-
40
- Retrieve registered devices or a specific one:
41
-
42
- ```bash
43
- remap-badblocks get [--id ID]
44
- ```
45
-
46
- #### `update`
47
-
48
- Compute and store badblocks, update the mapping:
49
-
50
- ```bash
51
- remap-badblocks update [--mode {read,write,skip}] [--block-range RANGE] [--output OUTPUT] [--spare-space N] id
52
- ```
53
-
54
- * `--mode`: how badblocks should operate (default: `read`)
55
- * `--block-range`: e.g., `0-100000` or `1573-`
56
- * `--output`: also save badblocks to a file
57
- * `--spare-space`: reserve N good sectors for future remapping
58
-
59
- #### `apply`
60
-
61
- Apply the device-mapper table to create a virtual remapped device:
62
-
63
- ```bash
64
- remap-badblocks apply [--id ID] [--method device-mapper]
65
- ```
66
-
67
- ## 🛠️ Example Workflow
68
-
69
- 1. Register the device:
70
-
71
- ```bash
72
- remap-badblocks add --path /dev/disk/by-id/myid mydrive
73
- ```
74
-
75
- 2. Run badblocks scan and create the mapping:
76
-
77
- ```bash
78
- remap-badblocks update --mode read --spare-space 512MB --id 1
79
- ```
80
-
81
- 3. Apply the remapping to create a safe virtual block device:
82
-
83
- ```bash
84
- remap-badblocks apply --id 1
85
- ```
86
-
87
- 4. Use `/dev/mapper/mydrive` as your new clean device
88
-
89
- ## ⚠️ Warnings
90
-
91
- * This tool **does not recover corrupted data**, it only prevents future reads/writes from known bad sectors.
92
- * Only usable on non-boot drives.
93
- * Always keep backups.
94
- * Devices are not persistent between boots, you have to manually apply them at startup (`remap-badblocks apply`), but this will be changed in the future.
95
-
96
- ## 📆 Future Plans
97
-
98
- ### Done
99
- - [x] Manage dependencies between different devices
100
- - [x] Empty db column for "apply at startup"
101
- - [x] Leave free space in disks for possible future metadata (around 4-8B per badblock + 12-24B per mapping, let's consider around 1k badblocks + 1k mappings = 16-32kB => maybe 100kB is good)
102
- - [x] Check already applied devices
103
- - [x] Add version option for getting version
104
-
105
- ## 🤝 Contributions Welcome
106
-
107
- Feel free to submit improvements or suggestions.
108
-
109
- For issues or feature requests, please [open a card on GitLab](https://gitlab.com/Luigi-98/remap_badblocks/-/issues).
@@ -1,130 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: remap_badblocks
3
- Version: 0.8
4
- Summary: CLI tool for remapping bad sectors on Linux disks using device-mapper
5
- Author-email: Luigi Privitera <priviteraluigi98@gmail.com>
6
- License-Expression: GPL-3.0-only
7
- Project-URL: Repository, https://gitlab.com/Luigi-98/remap_badblocks.git
8
- Project-URL: Issues, https://gitlab.com/Luigi-98/remap_badblocks/-/issues
9
- Requires-Python: >=3.10
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Provides-Extra: dev
13
- Requires-Dist: mypy; extra == "dev"
14
- Requires-Dist: flake8; extra == "dev"
15
- Requires-Dist: ruff; extra == "dev"
16
- Requires-Dist: pytest>=7.0; extra == "dev"
17
- Requires-Dist: pre-commit; extra == "dev"
18
- Requires-Dist: black; extra == "dev"
19
- Requires-Dist: isort; extra == "dev"
20
- Dynamic: license-file
21
-
22
- # remap\_badblocks
23
-
24
- `remap_badblocks` is a Linux utility that lets you safely create a virtual block device which skips bad sectors and transparently remaps new bad sectors to healthy spare sectors elsewhere on the same disk. It is useful for squeezing safe, stable usage out of partially failing disks.
25
-
26
- ## 🔧 How It Works
27
-
28
- * Stores devices configurations in a persistent database (this is crucial for accessing the remapped disks)
29
- * badblocks
30
- * mapping between real and virtual blocks
31
- * number of spare sectors in the device
32
- * It can either create a new mapping from scratch or update the existing one to remap new badblocks by keeping everything intact
33
- * It can generate device-mapper devices that follow the stored mappings
34
-
35
- ## 🚀 Usage
36
-
37
- ```bash
38
- remap-badblocks [-h] [-P DB_PATH] {add,get,update,apply} ...
39
- ```
40
-
41
- ### Global Options
42
-
43
- * `-P, --db-path` — path to the configuration database (default is internal)
44
-
45
- ### Commands:
46
-
47
- #### `add`
48
-
49
- Register a new device in the remap database.
50
-
51
- ```bash
52
- remap-badblocks add [--wwn WWN] [--path PATH] name
53
- ```
54
-
55
- * `name`: required alias for the device
56
- * `--wwn`: optional WWN of the device
57
- * `--path`: optional device path (e.g., `/dev/sdX`)
58
-
59
- #### `get`
60
-
61
- Retrieve registered devices or a specific one:
62
-
63
- ```bash
64
- remap-badblocks get [--id ID]
65
- ```
66
-
67
- #### `update`
68
-
69
- Compute and store badblocks, update the mapping:
70
-
71
- ```bash
72
- remap-badblocks update [--mode {read,write,skip}] [--block-range RANGE] [--output OUTPUT] [--spare-space N] id
73
- ```
74
-
75
- * `--mode`: how badblocks should operate (default: `read`)
76
- * `--block-range`: e.g., `0-100000` or `1573-`
77
- * `--output`: also save badblocks to a file
78
- * `--spare-space`: reserve N good sectors for future remapping
79
-
80
- #### `apply`
81
-
82
- Apply the device-mapper table to create a virtual remapped device:
83
-
84
- ```bash
85
- remap-badblocks apply [--id ID] [--method device-mapper]
86
- ```
87
-
88
- ## 🛠️ Example Workflow
89
-
90
- 1. Register the device:
91
-
92
- ```bash
93
- remap-badblocks add --path /dev/disk/by-id/myid mydrive
94
- ```
95
-
96
- 2. Run badblocks scan and create the mapping:
97
-
98
- ```bash
99
- remap-badblocks update --mode read --spare-space 512MB --id 1
100
- ```
101
-
102
- 3. Apply the remapping to create a safe virtual block device:
103
-
104
- ```bash
105
- remap-badblocks apply --id 1
106
- ```
107
-
108
- 4. Use `/dev/mapper/mydrive` as your new clean device
109
-
110
- ## ⚠️ Warnings
111
-
112
- * This tool **does not recover corrupted data**, it only prevents future reads/writes from known bad sectors.
113
- * Only usable on non-boot drives.
114
- * Always keep backups.
115
- * Devices are not persistent between boots, you have to manually apply them at startup (`remap-badblocks apply`), but this will be changed in the future.
116
-
117
- ## 📆 Future Plans
118
-
119
- ### Done
120
- - [x] Manage dependencies between different devices
121
- - [x] Empty db column for "apply at startup"
122
- - [x] Leave free space in disks for possible future metadata (around 4-8B per badblock + 12-24B per mapping, let's consider around 1k badblocks + 1k mappings = 16-32kB => maybe 100kB is good)
123
- - [x] Check already applied devices
124
- - [x] Add version option for getting version
125
-
126
- ## 🤝 Contributions Welcome
127
-
128
- Feel free to submit improvements or suggestions.
129
-
130
- For issues or feature requests, please [open a card on GitLab](https://gitlab.com/Luigi-98/remap_badblocks/-/issues).
File without changes
File without changes