• 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

fdisk: command not found

by admin

The fdisk utility is a menu-driven program that is used to create, modify, or delete partitions on a storage drive. Using fdisk, you can create a new partition table or modify existing entries on the partition table. The fdisk utility understands the DOS and Linux type partition tables. The fdisk utility also enables you to specify the size of partitions.

Syntax

The syntax of the fdisk utility is:

# fdisk [options] {device name}

fdisk Command Options

The fdisk utility supports a number of command-line options.

Option Used To
-b {sector size} Specify the number of drive sectors.
-H {heads} Specify the number of drive heads.
-S {sectors} Specify the number of sectors per track.
-s {partition} Print the partition size in blocks.
-l List partition tables for devices.

fdisk menu options

Aside from supplying command-line options, you can also choose various options when you are working in the fdisk menu.

Option Used To
n Create a new partition.
d Remove a partition.
p List existing partitions.
w Write changes to drive and exit utility.
q Cancel changes made and exit utility.

If you encounter below error while running the fdisk command:

fdisk: command not found

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

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

fdisk Command Examples

1. To set the sector size of a disk:

# fdisk -b 1024 /dev/sdd
(sector size = 512, 1024, 2048 or 4096) 

2. To specify the number of cylinders of the disk:

# fdisk -C 1024 /dev/sdb 

3. To Specify the number of heads of the disk:

# fdisk -H 1024 /dev/sdb 

4. To Specify the number of sectors per track of the disk:

# fdisk -S sects /dev/sdb 

5. To list the partition tables for the specified devices and then exit:

# fdisk -l
# fdisk -l /dev/sdb 

6. To get the size of a particular disk:

# fdisk -s /dev/sdb 

7. To switch off DOS-compatible mode:

# fdisk -c  

8. To get the help for fdisk:

# fdisk -h 

9. To get the version of the fdisk:

# fdisk -v

Conclusion

fdisk displays information about disk partitions, creates and deletes disk partitions, and changes the active partition. It is possible to assign a different operating system to each of the four possible primary partitions, though only one partition is active at any given time. You can also divide a physical partition into several logical partitions.

Filed Under: Linux

Some more articles you might also be interested in …

  1. sm: command not found
  2. fscrypt: command not found
  3. 12 RPM (Red Hat Package Manager) Command Examples
  4. CentOS / RHEL : How to Install and Configure OpenSSH Server and Client
  5. virt-xml-validate: command not found
  6. How to Enable Thin LVM Automatic Extension
  7. i3status: command not found
  8. login Command Examples in Linux
  9. updatedb: command not found
  10. sed Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Chezmoi: A multi-machine dotfile manager, written in Go
  • cheat: Create and view interactive cheat sheets on the command-line
  • chars: Display names and codes for various ASCII and Unicode characters and code points
  • chafa: Image printing in the terminal

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright