• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

blkdiscard: command not found

by admin

blkdiscard is a command-line utility in Linux that is used to discard (or “trim”) blocks of data from a block device, such as a hard drive or solid-state drive (SSD). Discarding blocks of data from a block device can help to improve the performance and efficiency of the device by reclaiming unused space and reducing the amount of unnecessary data that the device has to store and manage.

To use blkdiscard, you will need to have the blkdiscard utility installed on your Linux system. blkdiscard is usually included as part of the util-linux package, which is a collection of system utilities that are commonly used on Linux systems.

If you encounter the below error while running the blkdiscard command:

blkdiscard: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
Debian apt-get install mount
Ubuntu apt-get install mount
Alpine apk add util-linux
Arch Linux pacman -S util-linux
Kali Linux apt-get install mount
CentOS yum install util-linux
Fedora dnf install util-linux
Raspbian apt-get install util-linux

Once blkdiscard is installed, you can use it to discard blocks of data from a block device by running the blkdiscard command followed by the name of the device file. For example, to discard all the blocks of data from the block device /dev/sda, you could use the following command:

# blkdiscard /dev/sda

blkdiscard supports a variety of command-line options that allow you to customize the discard process, such as the range of blocks to discard or the size of the blocks to discard. You can use these options to fine-tune the discard process to suit your needs.

blkdiscard Comamnd Examples

1. Discard all sectors on a device, removing all data:

# blkdiscard /dev/device

2. Securely discard all blocks on a device, removing all data:

# blkdiscard --secure /dev/device

3. Discard the first 100 MB of a device:

# blkdiscard --length 100MB /dev/device

Filed Under: Linux

Some more articles you might also be interested in …

  1. grub-script-check Command Examples in Linux
  2. Understanding chroot Jail
  3. Search XML Attributes PowerShell XPath
  4. How to Determine Which Process is Writing to Disk in Linux
  5. How to extract RPM package without installing it
  6. tcpdump: command not found
  7. timeshift: command not found
  8. debootstrap Command Examples in Linux
  9. ndctl Command Examples in Linux
  10. Understanding Samba utilities – nmblookup, smbstatus, smbtar, testparm, wbinfo, smbget

You May Also Like

Primary Sidebar

Recent Posts

  • “aws s3api” Command Examples
  • “aws s3” Command Examples
  • “aws s3 rm” Command Examples
  • “aws s3 presign” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright