Disk Management Linux Commands - wAlber47/Tech-Journal GitHub Wiki

  • lsblk - lists devices within the file system
  • fdisk - provides disk partitioning functions
    • sudo fdisk /dev/sda - provides options on how to partition that disk
    • sudo fdisk -l - shows in-depth information about disks
  • dd - will convert and copy files from a specific location
    • if= - takes a path to the input location
    • of= - takes a path to the output file
      • If no output file is given, output will be shown on the command line.
    • bs - changes block size, makes the command run quicker, but the accuracy of command also goes down.
      • Recommended not to go above 4Mb.
    • conv=noerror - does not stop the command when an error is thrown.
    • conv=noerror,sync - ignores errors but also makes sure output is synced to the input.
  • mkfs - command used to format a drive or partition with a certain file sytem.
    • ext4 is recommended.
  • sha1sum - hashes a directory or drive.
    • sha1 is not the only option that can go here, (sha256sum, sha512sum, md5sum, md4sum).
    • Hashes of a drive and the copy of a drive should be identical.
  • mounting- will mount the disk to allow for changes.
    • You have to create a folder, which will be known as a mount point.
    • mount /Desktop/mountpoint - this command will mount the drive to the folder mountpoint.
    • umount /Desktop/mountpoint - this command will unmount the drive that is mounted in the folder mountpoint.
    • -o ro - will make the disk read only, (extremely important for forensics).
  • chmod - allows you to change the permissions of a directory or file.
    • -r - will change the permissions recursively for everything inside the file.