Skip to content

Commit

Permalink
Start splitting filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
cirosantilli committed Feb 2, 2015
1 parent a151d09 commit 5200ca7
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 57 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,19 @@ Pagers:
- [more](more.md)
- [pg](pg.md)

File and directories:
Files, directories, partitions:

- [badblocks](badblocks.md)
- [blkid](blkid.md)
- [cp](cp.sh)
- [du](du.md)
- [e2fsck](e2fsck.md)
- [e2fsprogs](e2progs.md)
- [fdupes](fdupes.md)
- [find](find.md)
- [locate](locate.md)
- [ls](ls.md)
- [lsblk](lsblk.md)
- [Swap partition](swap-partition.md)
- [tree](tree.md)

Expand Down
13 changes: 13 additions & 0 deletions badblocks.md
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.
19 changes: 19 additions & 0 deletions blkid.md
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"
8 changes: 8 additions & 0 deletions e2fsck.md
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?
13 changes: 13 additions & 0 deletions e2fsprogs.md
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.
2 changes: 2 additions & 0 deletions eclipse.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Navigate in editor and its tabs:

- `Ctrl + Shift + R`: find files.

- `Ctrl + Shift + G`: find where the id (class, method, etc.) under the cursor is used.

- `Ctrl + O`: dropdown filter jump to method definition in current file

Search entire
Expand Down
56 changes: 0 additions & 56 deletions filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,52 +371,6 @@ CD DVD.

A SanDisk SD card had a device named `mmcblk0`.

### 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

## UUID

Unique identifier for a partition. Field exists in ext and NTFS.
Expand All @@ -433,16 +387,6 @@ Get all devices:

sudo lsblk -no UUID /dev/sda1

## blkid

`util-linux` package.

Get UUID, label and filesystem type for all partitions:

sudo blkid

## Label

An ext partitions concept.

Determines the mount name for the partition.
Expand Down
45 changes: 45 additions & 0 deletions lsblk.md
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

0 comments on commit 5200ca7

Please sign in to comment.