Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
Last edited by dr_zayus69; 03-03-2005 at 12:14 PM.
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
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.
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?
Last edited by dr_zayus69; 03-04-2005 at 02:08 AM.
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.
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.
Last edited by dr_zayus69; 03-04-2005 at 04:33 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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.