• Home »
  • Insights »
  • Install NTFSResize Using Yum on CentOS, NTFSResize to Verify Partition Table

Install NTFSResize Using Yum on CentOS, NTFSResize to Verify Partition Table

NTFSResize is a very useful tool on Linux when you also have Windows computers in your household. I have had many NTFS hard drives fail over time and its nice to plug them into a Linux server and gain basic information about them. A brief description from the man page is located below and if you want to view the entire man page for all of the switches that are available for ntfsresize simply click on the name.

ntfsresize– resize an NTFS filesystem without data loss

The ntfsresize package is part of a set of tools on Linux so it is included in the ntfsprogs application. The ntfsresize application will be installed with a set of tools called ntfsprogson CentOS using the the yum command below.

bash

  1. yum install ntfsprogs

There are other NTFS tools required to link tools with the NTFS library, called libntfs, available in the package ntfsprogs-devel. This can be installed on CentOS using yum with the command below.

bash

  1. yum install ntfsprogs-devel

The ntfsresize command can be used not only to resize a NTFS drive but also to obtain basic information about the drive. If you issue the -i switch you will get details about a specific drive. In the below example the disk is damaged which will require us to force the command which will be explained later.

Example ntfsresize -i:

bash

  1. [root@dev ~]# ntfsresize -i /dev/sda2
  2. ntfsresize v1.13.1 (libntfs 9:0:0)
  3. ERROR: Volume is scheduled for check.
  4. Run chkdsk /f and please try again, or see option -f.

When using the -f switch along with the -i switch you will get output similar to the below. In the below example the NTFS drive is damaged.

bash

  1. [root@dev ~]# ntfsresize -f -i /dev/sda2
  2. ntfsresize v1.13.1 (libntfs 9:0:0)
  3. Device name : /dev/sda2
  4. NTFS volume version: 3.1
  5. Cluster size : 4096 bytes
  6. Current volume size: 79966171648 bytes (79967 MB)
  7. Current device size: 79966172160 bytes (79967 MB)
  8. Checking filesystem consistency ...
  9. 100.00 percent completed
  10. Accounting clusters ...
  11. Cluster accounting failed at 12967 (0x32a7): missing cluster in $Bitmap
  12. Cluster accounting failed at 16296 (0x3fa8): extra cluster in $Bitmap
  13. Cluster accounting failed at 16714 (0x414a): extra cluster in $Bitmap
  14. Cluster accounting failed at 29874 (0x74b2): extra cluster in $Bitmap
  15. Cluster accounting failed at 29908 (0x74d4): extra cluster in $Bitmap
  16. Cluster accounting failed at 476117 (0x743d5): extra cluster in $Bitmap
  17. Cluster accounting failed at 476118 (0x743d6): extra cluster in $Bitmap
  18. Cluster accounting failed at 476119 (0x743d7): extra cluster in $Bitmap
  19. Cluster accounting failed at 476120 (0x743d8): extra cluster in $Bitmap
  20. Cluster accounting failed at 3645440 (0x37a000): missing cluster in $Bitmap
  21.  
  22. Filesystem check failed! Totally 422909 cluster accounting mismatches.
  23. ERROR: NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!
  24. The usage of the /f parameter is very IMPORTANT! No modification was
  25. and will be made to NTFS by this software until it gets repaired.

In an attempt on a different drive that is also damaged ntfsresize provide the below output.

bash

  1. [root@dev working]# ntfsresize --info --force laptop
  2. ntfsresize v1.13.1 (libntfs 9:0:0)
  3. Device name : laptop
  4. NTFS volume version: 3.1
  5. Cluster size : 4096 bytes
  6. Current volume size: 79966171648 bytes (79967 MB)
  7. Current device size: 75937648640 bytes (75938 MB)
  8. ERROR: Current NTFS volume size is bigger than the device size!
  9. Corrupt partition table or incorrect device partitioning?

You can use ntfsresize to then resize the partition if possible.

Beginning the Linux Command Line (Expert’s Voice in Open Source) (Paperback)


List Price: $34.99 USD
New From: $9.99 USD In Stock
Used from: $0.01 USD In Stock

WD Black 320 GB Mobile Hard Drive, 2.5 Inch, 7200 RPM, SATA II, 16 MB Cache (WD3200BEKT) (Old Model) (Personal Computers)


List Price: $119.99 USD
New From: $41.00 USD In Stock
Used from: $15.99 USD In Stock

Share