Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

NTFS partition reports bad Cluster Accounting

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
User avatar
PsySc0rpi0n
Posts: 322
Joined: 2012-10-24 13:54
Location: Bitcoin World
Has thanked: 8 times
Been thanked: 1 time

NTFS partition reports bad Cluster Accounting

#1 Post by PsySc0rpi0n »

I'm using gparted 0.25.0 to try to shrink an ntfs partition I have in a secondary hdd so that I can create a new ext4 partition but when I try to do this, I get errors. I'm using Debian Stretch 64 bit, kernel 4.174.17.0-0.bpo.3-amd64 (4.17.17-1~bpo9+1 (2018-08-27) x86_64 GNU/Linux).

Before unmounting this hdd no errors show up.

After unmounting it and checking partition info in gparted I get this:

Image

I have ntfs-3g installed so I assume it's not dependencies problem.

Then when I try to check the partition with gparted Partition->Check menu I get this:

Image

Any idea how can I fix this?

CwF
Global Moderator
Global Moderator
Posts: 2684
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: NTFS partition reports bad Cluster Accounting

#2 Post by CwF »

Generally don't do this I think is my answer. I use ntfs all over, passed, in a qcow, all in vm's and have a handful of gotchas I try to avoid, this is one. Resizing in a vm with native software will work better. A few of these issues seem to stem from the meta data held in the ntfs system areas. I'm not saying I know exactly, but most the tools I've tried to manipulate ntfs images that have ran under a windows os, usually get borked. If created under debian and never initialized in a windows OS seems to be different? Anyway, I once did do a resize mounting the image as a loop device, then gparted resize expand, and then run under the vm. It seemed fine after a disk check in windows and I ran it for a few months. Then I noticed it seemed a few gigs larger than it should be. Those gigs were 'bad sectors" recorded in the meta data and no process I tried could reclaim the space. On shrinks it seems there is meta info that is left that points beyond the partition limits, so a disk check may fix it. Or if you can use a native windows app to pack the data at the beginning, so all meta data is correct, maybe even resize the partition with open space at the end, then truncate when mounted as a loop device something like:

Code: Select all

truncate --size=$[(End sector+1)*blocksize] newimage.img
Then I should pay attention! Since this is a real disk, use windows to condense and leave unpartitioned space.
Then mount under debian and continue...

User avatar
PsySc0rpi0n
Posts: 322
Joined: 2012-10-24 13:54
Location: Bitcoin World
Has thanked: 8 times
Been thanked: 1 time

Re: NTFS partition reports bad Cluster Accounting

#3 Post by PsySc0rpi0n »

Well, thank you very much for replying.

I ended up downloading an windows 7 64 bit ISO image, create a VM in VirtualBox with that image, and then with Rufus software created an USB pen drive with the same ISO image. Rebooted and performed an chkdsk /f twice on this drive and fixed the problem.
After that I was already able to perform all other operations with gparted!

I spent almost an entire day trying to fix this with Linux tools and couldn't do it! Probably it could be done but I didn't had any more knowledge!

Thanks
PsySc0rpi0n

Post Reply