Disk - jasper-zanjani/dotfiles GitHub Wiki
Disk blkid cryptsetup dd df dm-crypt dumpe2fs e2fsck e2label eject fdformat fdisk fsck fstrim gdisk hdiutil hdparm ioping iostat [iscsiadm][iscsiadm] lsblk mdadm mke2fs mkfs mkntfs mkswap mount mt parted partprobe partx resize2fs resize4fs sfdisk swapoff swapon tune2fs umount vifs xfs_info xfs_metadump
Logical volume management lvcreate lvdisplay lvextend lvremove lvs lvscan pvcreate pvdisplay pvremove pvs pvscan vgcreate vgdisplay vgextend vgreduce vgremove vgs vgscan
Index node (inode) is a data structure that stores all the information about a file except its name and data
Most modern Linux distributions use the ext4
filesystem, which descends from ext3
and ext2
, and ultimately ext
. Other filesystems in use include btrfs
, xfs
, and zfs
Source: ref
Extended File System was first implemented in 1992 by Remy Card to address limitations in the MINIX filesystem, which was used to develop the first Linux kernel. It could address up to 2GB of storage and handle 255-character filenames and had only one timestap per file.
ext2 was developed by Remy Card only a year after ext
's release as a commercial-grade filesystem, influenced by BSD's Berkeley Fast File System. It was prone to corruption if the system crashed or lost power while data was being written and performance losses due to fragmentation. Nevertheless, it was quickly and widely adopted, and still used as a format for USB drives.
ext3 was adopted by mainline Linux in 2001 and uses journaling, whereby disk writes are stored as transactions in a special allocation, which allows a rebooted system to roll back incomplete transactions. 3 journaling modes: journal, ordered, and writeback
ext4 was added to mainline Linux in 2008, developed by Theodore Ts'o, and improves upon ext3
but is still reliant on old technology.
- true next-generation filesystem with a problematic license
- ZFS on Linux (ZOL) is considered the ugly stepchild of the ZFS community despite the fact that the Linux implementation has the most features and the most community support
- ZFS is too tightly bound to the operation of the kernel to operate in true userspace, and that is why each implementation is different for operating systems
- ZFS is too tightly bound to the operation of the kernel to operate in true userspace, and that is why each implementation is different for operating systems
- ZFS is too tightly bound to the operation of the kernel to operate in true userspace, and that is why each implementation is different for operating systems
- LU: 284
B-Tree Filesystem "butter fs" was adopted by SUSE Enterprise Linux, but support was dropped by Red Hat in 2017.
Incorporate full-disk encryption on /dev/sdb1, asking for passphrase twice
cryptsetup --verify-passphrase luksFormat /dev/sdb1
Assign virtual name "storage1" to encrypted disk /dev/sdb1
cryptsetup luksOpen /dev/sdb1 storage1
Implement a simple CPU benchmark by writing 1 GB of zeroes and piping it to md5sum
dd if=/dev/zero bs=1M count=1024 | md5sum
b
c
h
l
o
s
t
u
w
B
C
H
L
S
V
W
a
b
c
d
g
i
l
m
n
o
p
q
s
t
u
v
w
x
F
G
I
O
Discover iSCSI targets
iscsiadm discovery
Create a 20 gigabyte logical volume named "Marketing" from volume group {vg1}
lvcreate -L 20G vg1 -n Marketing
Create logical volume named lv1
of size 500G from volume group vg1
lvcreate -L 500G vg1 -n lv1
Resize existent logical volume {Marketing} in volume group {vg1} to have an additional 10 gigabytes of space
lvresize -L +10G /dev/vg1/Marketing
Create an ext4 filesystem on {partition}
mkfs -t ext4 partition
Specify {filesystemtype} to be created
mkfs -T filesystemtype
partx
is a utility that provides information on drive partitions to the Linux kernel. [12]
Display partition table of a drive
partx --show /dev/sda
Show details of only one partition of a drive
partx --show /dev/sda1
Specify a range of partitions on a drive
partx -o START, END --nr 10 /dev/sda
Add all partitions on a disk to the system
partx -a /dev/sda
Display length in sectors and human-readable size of a partition
partx -o SECTORS,SIZE /dev/sda1 /dev/sda
Remove the last partition
partx -d --nr -1:-1 /dev/sda
Disable headers
partx -o START -g --nr 5 /dev/sda
Script-based partition table editor, similar to fdisk
and gdisk
, which can be run interactively. It does not interface with GPT format, neither is it designed for large partitions. [ref][11]
List partitions on all devices
Display size of {partition} or {device}
This command produces the size of {partition} (i.e. /dev/sda1
) or even {device} (/dev/sda
) in blocks
sfdisk -s partition
sfdisk -s device
Apply consistency checks to {partition} or {device}
sfdisk -V partition
sfdisk --verify device
Create a partition
sfdisk device
Save sectors changed This command will allow recovery using the following command
sfdisk /dev/hdd -O hdd-partition-sectors.save
Recovery
Man page indicates this flag is no longer supported, and recommends use of dd
instead.
sfdisk /dev/hdd -I hdd-partition-sectors.save
Instruct system to begin using {partition} as a swap file
swapon partition
Adjust various ...
Run fsck
on {/dev/sdb1} on every boot
tune2fs -c 1 /dev/sdb1
Run fsck
on {/dev/sda1} at intervals of 60 mounts or 6 months
tune2fs -c 60 -i 6m /dev/sda1
Enable journaling on ext2 partition {/dev/sdc1}
tune2fs -j /dev/sdc1
Assign label "Sales" to logical volume {/dev/vg1/Sales}
tune2fs -L Sales /dev/vg1/Sales