NTFS partition reports bad Cluster Accounting

If none of the more specific forums is the right place to ask

NTFS partition reports bad Cluster Accounting

Postby PsySc0rpi0n » 2018-08-31 16:28

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?
User avatar
PsySc0rpi0n
 
Posts: 24
Joined: 2012-10-24 13:54

Re: NTFS partition reports bad Cluster Accounting

Postby CwF » 2018-08-31 17:02

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...
CwF
 
Posts: 102
Joined: 2018-06-20 15:16

Re: NTFS partition reports bad Cluster Accounting

Postby PsySc0rpi0n » 2018-08-31 21:17

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
User avatar
PsySc0rpi0n
 
Posts: 24
Joined: 2012-10-24 13:54


Return to General Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable