LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Help understanding ntfsresize? (https://www.linuxquestions.org/questions/linux-software-2/help-understanding-ntfsresize-297206/)

dr_zayus69 03-03-2005 11:38 AM

Help understanding ntfsresize?
 
when you use ntfsresize is the number you give for the resizing the overall number it will be resized to our the amount that gets taken off the end of the ntfs filesystem? Also it says the end is fragmented but it is a fresh install of windows xp pro. Shouldn't a fresh install not need fragmenting?

homey 03-03-2005 11:48 AM

Quote:

Shouldn't a fresh install not need fragmenting?
That would seem logical but you are talking about Windows....

At any rate, you can use the --info switch to see how much the partition can be safely resized to.
For example...
ntfsresize --info /dev/hda1 #this will show how much space can be gained.

Then, you can resize the partition. The number on the end is going to be the new size of the ntfs partition.
For example...
ntfsresize --size 8000M /dev/hda1 #in this case, I'm resizing the file system to an available amount of 8000M (8GB).

If you aren't comfy doing that, you could boot up with the knoppix cd and use the GUI tool called qtparted to resize the partition.

dr_zayus69 03-03-2005 12:11 PM

thanks for the quick reply. I have a 60 gb harddrive with windows on it and i want to leave about 25 for linux so just to make sure i understand you i would do:

ntfsresize -s 35000M (or 35840) /dev/hda1?

I didn't know that qt would automatically adjust the filesystem cuz i know with ntfsresize it doesn't resize the partition just the file system. So i'd still need something to adjust the partitions.

edit: Yeah i figured the fragmentation was due to windows shottiness.

homey 03-03-2005 12:15 PM

Quote:

ntfsresize -s 35000M (or 35840) /dev/hda1?
What's the output of ntfsresize --info /dev/hda1 ?

dr_zayus69 03-03-2005 12:44 PM

root@ttyp0[knoppix]# ntfsresize -i /dev/hda1
ntfsresize v200309071734captive1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 60022448128 bytes (60023 MB)
Current device size: 60022448640 bytes (60023 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use : 1834 MB (3.1%)
Calculating smallest shrunken size supported ...
You could resize at 30013247488 bytes or 30014 MB (freeing 30009 MB).

homey 03-03-2005 01:00 PM

Quote:

You could resize at 30013247488 bytes or 30014 MB (freeing 30009 MB).
That's good and means that your plans to resize to 35Gigs is ok.
ntfsresize -s 35000M /dev/hda1

Qtparted handles the entire operation ( partition and file system ) but if you are willing to use the command line, here are my notes.
Code:

When decreasing the size of a partition, do the file system first. This is true for Windows or Linux partitions.

To resize an NTFS partition to a smaller amount:
Run defrag and scandisk before proceeding
Boot up with the rescue cd
I backup the partition table with the command:
sfdisk -d /dev/hda > /mnt/images/w2part

ntfsresize --info /dev/hda1  #this will show how much space can be gained.
ntfsresize --size 8000M /dev/hda1  #in this case, I'm resizing the file system to an available amount of 8000M (8GB).

After resizing ( decreasing ) the file system, then
Run the fdisk utility to resize ( decrease ) the partition. ## note: the partition needs to be slightly larger than the file system size unless you are a magician and can get a perfect match where the file system will fit inside the new partition size.
fdisk /dev/hda
Delete the old partition and create a new one. Make sure to use the original starting point and make any changes only at the end of the partition.
Don't forget to set the partition type to 7 (NTFS) and write the changes.
Reboot and let Windows do the chkdisk thing.
Reboot with the rescue cd and run the resize with no options to make sure the file sytem matches the partition size: ntfsresize /dev/hda1


dr_zayus69 03-03-2005 01:06 PM

thanks for all your help.

edit: now i get this output when doing a a test.

root@ttyp0[knoppix]# ntfsresize -n -s 35840M /dev/hda1
ntfsresize v200309071734captive1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 60022448128 bytes (60023 MB)
Current device size: 60022448640 bytes (60023 MB)
New volume size : 35840000000 bytes (35840 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use : 1834 MB (3.1%)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Updating $BadClust file ...
ERROR: Device has bad sectors, not supported

does that mean i can not do it with ntfsresize at all or is there something i can do to be able to still use it?

homey 03-03-2005 01:27 PM

Quote:

Schedule chkdsk for NTFS consistency check at Windows boot time ...
You need to boot up into windows and tell it to do a chkdsk ( scan disk ) operation.
I'm not sure if xp is the same as w2k in this respect but here's info using w2k....
Right click on Start / open explorer
Right click on Local Disk ( C : ) / select properties
Select the Tools tab...
Error-checking / Check Now...
[X] Automatically fix file system errors / Start
Reboot into windows to actually start that operation.
When the chkdisk is complete, then boot into the live cd.

dr_zayus69 03-04-2005 01:04 AM

ok im stuck.

root@ttyp0[knoppix]# ntfsresize -n -s 35840M /dev/hda1
ntfsresize v200309071734captive1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 60022448128 bytes (60023 MB)
Current device size: 60022448640 bytes (60023 MB)
New volume size : 35840000000 bytes (35840 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use : 1835 MB (3.1%)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Updating $BadClust file ...
ERROR: Device has bad sectors, not supported

i did chkdsk /f /r a second time. I went to western digital and got a utility to check my disk and it says i have 2 or more unrepairable errors. Is there no hope in resizing this ntfs filesystem? Here is what i wanted to do. I wanted to shrink down the ntfs, resize the partition, move the partition forward a bit so i could make a /boot partition to install grub into to chain load with NTLDR to boot a distro in the space i made by resizing. (+ the swap) Would i just have to get rid of xp repartition the drive to meet those requirements?

edit: or could i use the f option of ntfsresize to force the changes? Or would that not be a good idea?
edit2: even qtparted gives the same error.
edit3: zero filling the drive wouldn't get rid of the bad sectors would it? It would just erase everything in the good ones?

jiml8 03-04-2005 03:49 AM

Quote:

ntfsresize v200309071734captive1
Why don't you try a more recent version of ntfsresize? The ntfsresize FAQ says:
Quote:

Before resizing an NTFS, ntfsresize makes a filesystem consistency check and it refuses to progress, giving the above messages, if it found errors. In these cases you need to boot Windows and run chkdsk with the /f (fix errors) command line option. If chkdsk asks you about if it should check the drive the next time you restart the computer then answer 'y' (yes) and restart Windows. If you don't specify the /f option then chkdsk will not fix the NTFS consistency problems.

If you still have these messages after running chkdsk /f then you probably use ntfsresize version 1.7.1. You should use at least ntfsresize version 1.9.0.
Quote:

I wanted to shrink down the ntfs, resize the partition, move the partition forward a bit so i could make a /boot partition
Won't work. You can resize it but you can't change its starting point.

dr_zayus69 03-04-2005 04:24 AM

i was using the version that came with knoppix 3.6 So i will check to see if newer versions are available in the lastest version of knoppix. But also i got the same error with QTParted so there is a chance that it is not just ntfsresize. This computer is getting up there in age so i have a feeling it is the drive that is going.

Padma 03-04-2005 10:17 AM

Knoppix 3.7 has the version you need.

dr_zayus69 03-04-2005 02:19 PM

thanks i'll try that out.

igu 03-18-2005 06:02 AM

Ntfsresize also detected the unrepairable disk errors, just like the Westerd Digital utility, so it refused to progress to protect your data. Otherwise you would have a great chance to lose everything.

However I think it's too cautious. Ntfsresize being open source, here is a modified version that will let you resize partitions on dying disk: http://www.bodden.de/misc/ntfsrecovery/

NOTE: BACKUP! You really can lose the data because your disk is not reliable. Of course the unrepairable disk errors won't be fixed either, only hacked around by ignoring them. If you run chkdsk /r then they will reappear again. Unfortunately they will stay there forever and you should expect more as time goes.

Good luck!


All times are GMT -5. The time now is 03:49 AM.