BM

Block Storage

Info on how linux access data

Device Files

Everything in Linux is a file.
This philosophy extends to hardware devices which are given special Device Files

There are two types of Device Files:

  • Block Device: Has buffered I/O in a predetermined block size. (SSD reads/writes blocks of size 512MB)
  • Character Device: Does not buffer I/O, transfers data per character, (keyboard, mouse ...)

lsblk


List block devices

Other devices (network/character) are not shown with this command Only the block devices are listed

Partitions are shown as the numbered block devices Each block device is shown its TYPE, MOUNTPOINT, ""

lsblk --fs
blkid --output list

To show information about the file system on each partition

fdisk


Disk partitioning tool

df


Disk Free: check the disk space usage for file systems

dd


Disk-Dump (Disk Destroyer!) utility

  • Can be used for creating the live-USB to have a portable boot-able OS made from an iso file
  • Transfer files to USB device (once mounted in root filesystem)
dd if=inputfile.txt of=outputfile.txt bs={blocksize} status=progress

mount


Once an external device is plugged in (USB, harddrive ...) it must be mounted to the filesystem

  • The mount command will mount the device somewhere in the root filesystem
  • Typically in the /mnt/ directory
mount --mkdir /dev/sdc /mnt/phillips_usb

umount

  • Un-mount the filesystem, the USB drive will remain visible to filesystem (and can even be re-mounted)
  • Will flush any pending writes to the USB making it safe to physically remove from computer

eject

  • Does a umount followed by making the USB un-recognizable by hardware until a system reboot