-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a151d09
commit 5200ca7
Showing
8 changed files
with
106 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# badblocks | ||
|
||
e2fsprogs package. | ||
|
||
Most useful invocation: | ||
|
||
badblocks -nvs /dev/sdb | ||
|
||
- `-n`: non-destructive read-write mode. The default is non-destructive read-only. | ||
- `-s`: show progress | ||
- `-v`: verbose information | ||
|
||
The output of `badblocks -v` can be used as the input of `e2fsck -l` to mark some blocks as bad and not use them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# blkid | ||
|
||
`util-linux` package. | ||
|
||
Get UUID, label and filesystem type for all partitions | ||
|
||
sudo blkid | ||
|
||
Sample output: | ||
|
||
/dev/sda2: LABEL="DATA" UUID="E4EEDB25EEDAEF34" TYPE="ntfs" | ||
/dev/sdb1: LABEL="ESP" UUID="9E91-F4F8" TYPE="vfat" | ||
/dev/sdb2: LABEL="DIAGS" UUID="ECC5-8CEC" TYPE="vfat" | ||
/dev/sdb4: LABEL="WINRETOOLS" UUID="0058C6EB58C6DE92" TYPE="ntfs" | ||
/dev/sdb5: LABEL="OS" UUID="4C38CCBD38CCA6F4" TYPE="ntfs" | ||
/dev/sdb6: LABEL="PBR Image" UUID="C2CE5FDBCE5FC677" TYPE="ntfs" | ||
/dev/sdb7: UUID="3fabbe75-0c62-4705-a3ad-4e87c5dcc143" TYPE="ext4" | ||
/dev/sdb8: UUID="56886cc6-e247-488a-9acf-a07a99cfa3ca" TYPE="ext4" | ||
/dev/sdb9: UUID="bbc2c9bf-4846-44d1-81c0-eade6d2dcefb" TYPE="swap" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# e2fsck | ||
|
||
Black list bad blocks so that the OS will not use them: | ||
|
||
sudo badblocks -v /dev/sdb > /tmp/bad-blocks.txt | ||
sudo e2fsck -l /tmp/bad-blocks.txt /dev/sdb | ||
|
||
TODO: is black-listing a feature of ext filesystems? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# e2fsprogs | ||
|
||
Library of ext filesystem utilities. | ||
|
||
<http://en.wikipedia.org/wiki/E2fsprogs> | ||
|
||
Contains: | ||
|
||
- `badblocks` | ||
- `blkid` | ||
- `e2fsck` | ||
|
||
Present by default on almost all Linux distributions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# lsblk | ||
|
||
List block devices, including those which are not mounted. | ||
|
||
sudo lsblk | ||
|
||
Sample output: | ||
|
||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | ||
sda 8:0 0 465.8G 0 disk | ||
|-sda1 8:1 0 1.5G 0 part | ||
|-sda2 8:2 0 93.2G 0 part /media/win7 | ||
|-sda3 8:3 0 13.7G 0 part | ||
|-sda4 8:4 0 1K 0 part | ||
|-sda5 8:5 0 338.1G 0 part / | ||
|-sda6 8:6 0 3.7G 0 part [SWAP] | ||
`-sda7 8:7 0 15.6G 0 part | ||
sdb 8:16 0 931.5G 0 disk | ||
`-sdb1 8:17 0 931.5G 0 part /media/ciro/DC74FA7274FA4EB0 | ||
|
||
`-f`: show mostly information on filesystems: | ||
|
||
sudo lsblk -f | ||
|
||
Sample output: | ||
|
||
NAME FSTYPE LABEL MOUNTPOINT | ||
sda | ||
|-sda1 ntfs SYSTEM_DRV | ||
|-sda2 ntfs Windows7_OS /media/win7 | ||
|-sda3 ntfs Lenovo_Recovery | ||
|-sda4 | ||
|-sda5 ext4 / | ||
|-sda6 swap [SWAP] | ||
`-sda7 ext4 | ||
sdb | ||
`-sdb1 ntfs /media/ciro/DC74FA7274FA4EB0 | ||
|
||
`-o`: select which columns you want exactly. Most useful information for humans: | ||
|
||
sudo lsblk -o NAME,FSTYPE,MOUNTPOINT,LABEL,UUID,SIZE | ||
|
||
`-n`: don't output header with column names. Good way to get information computationally. E.g., get UUID of `/dev/sda1`: | ||
|
||
sudo lsblk -no UUID /dev/sda1 |