1 (edited by Stevejs 2013-02-07 11:32:17)

Topic: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

I have acquired an old Pentium 3 laptop. It has a 40GB HDD installed, all in one NTFS partition, and about 8GB of software (OS Windows XP).

I want to clone the drive on to a 20GB, keeping the existing software, so that I can use the 40GB on another machine, but first I would need to resize the C: partition down to below 20GB. I have downloaded gparted-live-0.14.1-6 and burnt it to a CD, but it is unable to resize an NTFS partition. The volume in the Gparted window shows an exclamation mark in a yellow triangle, and info says:

Unable to read the contents of this file system!
Because of this some operations may be unavailable.

The cause might be a missing software package.
The following list of software packages is required for ntfs file system support: ntfsprogs / ntfs-3g.

This doesn't seem to be anything to do with the problem described in the 'sticky' on this forum.

Presumably ntfsprogs has to be on the CD, but to get there it would have to be included in the iso file before I burned it. I've no idea how to do this.

Is what I am trying to do actually possible, and if so, can anyone give me some idea of what I would have to do to get it to work?

Thanks,

Steve.

2

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

If the NTFS file system was not shut down properly, then it might be in an inconsistent state.

Try booting into Windows, and then use the Start --> Shutdown option so that Windows shuts down cleanly.  Then try booting GParted Live.

3

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

Thanks. That looked like a possibility because I think the last time I booted Windows it was into Safe Mode, but I just tried booting and shutting down normally and the result is the same!

4

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

Another thing I should have mentioned: the info box also tells me the disc has "at least 1 bad sector". I knew there had been one but I thought the disk test I ran had repaired it, and Gparted was just picking up the existence of a repaired sector. Now I think about it a bit more, I think that probably doesn't make sense, and possibly that is the cause of the problem.

I will run the hdd test program again, and chkdsk.

5

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

Ran the hdd test again (Fujitsu), which found nothing wrong, and chkdsk /f /r again, which also found no problem, so the only software to claim there is/are bad sector/s is Gparted! It was another hdd I remembered as having had a sector repaired by its test program.

Is ntfsprogs included on the Gparted-live CD, and therefore is the warning message in my first post just a general-purpose message to be displayed whether ntfsprogs is loaded or not?

6

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

The ntfsprogs package is included on the GParted Live image.

Would you be able to provide the output from the following command?

sudo ntfsresize --info --force --no-progress-bar /path-to-your-ntfs-partition

Where /path-to-your-ntfs-partition is something like /dev/sda2

7

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

I'm away from home at present, but I will see what I can do when I get back in a couple of days.

I am a total ignoramus Linux-wise, but I seem to remember seeing a command-line option somewhere during the boot (or was it during clonezilla boot?), and /dev/sda2 rings a faint bell!

Thanks, Steve.

8

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

Concerning the bad sector issue:

Stevejs wrote:

Ran the hdd test again (Fujitsu), which found nothing wrong, and chkdsk /f /r again, which also found no problem, so the only software to claim there is/are bad sector/s is Gparted! It was another hdd I remembered as having had a sector repaired by its test program.

Bad sectors are usually detected by the HD firmware and are marked to be remapped. This is done by the firmware, not by the operating system or other software.
Remapping is done the next time there is access to the specific sectors. If the sector is allocated and just not easily readable, the content isn't lost. If it is really bad, a file or folder might be corrupted.

So, it is probable that a detected bad or suspect sector was remapped by the various operations after this detection.

Furthermore, there is a list of "known bad sectors" kept by the operating system. This list isn't automatically updated, that's why these (previously bad and later remapped) sectors remain in the list.
Format resets this list. I know it is possible to rebuild the list in the linux filesystems, but I don't know how this is possible in ntfs without format.

You can check the SMART status of the hard drive from the terminal window, with the command
sudo smartctl -a /dev/sda
(use the right /dev/sdx name for the hard drive in your case).
This will display among other the number of already relocated sectors and the number of sectors pending to relocation. These results appear in the last column.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

9

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

gedakc: I get what is basically the same error message as before -

ntfsresize v2012.1.15AR.8 (libntfs-3g)
devicename         : /dev/sda1
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 40007729664 bytes (40008 MB)
Current device size: 40007729664 bytes (40008 MB)
ERROR: This software has detected that the disc has at least 1 bad sector.

Presumably there is no issue with ntfsprogs, so I guess it is the "bad sector" that is the problem.

class413: smartctl gives several pages of output. Using the command on its own I only see what I assume is the last page. I've used |more and |less, and see a different page, but still only one, and pressing the space-bar does nothing. If it is relevant it says "SMART overall-health self-assessment test result: PASSED".

10

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

Some users have worked around this bad sector problem.  See,
Howto: Use ntfsresize+fdisk to resize a partition with bad sectors.

11

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

This gives a solution to the resize problem, using the command line tools.

Another method could be something I found in a technical forum: the author recommends DFSee, a commercial software that gives however some free time without registration. According to the documentation, it can do this (look for "reset bad sectors"). It needs installation to the system. This means that the system must work (you can't use it in a damaged system). After this, I would advice to repeat chkdsk /r , to be sure that there is nothing wrong.

For newer versions of microsoft operating systems there is the parameter /b for chkdsk, that resets the bad sector list. This isn't available in xp.

class413: smartctl gives several pages of output. Using the command on its own I only see what I assume is the last page. I've used |more and |less, and see a different page, but still only one, and pressing the space-bar does nothing. If it is relevant it says "SMART overall-health self-assessment test result: PASSED".

I think you can roll the terminal content up to read the entire log.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

12

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

Thanks for the very interesting links. I'll try working my way through the first one tomorrow and report back - but don't hold your breath: I am getting in a bit over my head here!

13

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

Another idea: connect the drive to a vista or win7 computer and run chkdsk with the /b option.
Perhaps you have to disable the BOOT attribute of the partition, and reset it after check.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

14

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

Partial success?

I went through the command line procedure as shown in gedakc's link, using ntfsresize to reduce to 18000MB. It appeared to work. Windows is bootable (I've run chkdsk a couple of times).

Disk management in Windows shows the capacity of C: as 16.76GB, which I guess is right, but it shows Disk 0 as C: occupying the full 37.26GB. Also when I boot Gparted to the GUI window it still shows sda1 as occupying the full space.

Reading further into the instructions in the link, I evidently need to re-write the partition table, but I seem to be getting tangled up in fdisk!

sudo fdisk -l gives me:

Device: /dev/sda1
Boot: *
Start: 63
End: 78140159
Blocks: 39070048+
Id: 7
System: HPFS/NTFS/exFAT

I get to the point in fdisk where I have typed 'd' to delete the partition and typed 'n' to create a new one. What I get is different from the link, and I am lost:

Partition type:
   p  primary (0 primary, 0 extended, 4 free)
   e extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-78140159, default 2048):

It is talking sectors rather than cylinders. If I enter '63' to tally with the figure above it tells me "Value out of range". What happens if I accept the default? Isn't it going to chop off a chunk of my boot drive?

I told you I was getting in over my head!

15

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

Since sector 63 is traditionally the first track in the cylinder alignment scheme used by DOS, you likely need to use the DOS mode of fdisk to set this value.

Try adding "-c=dos" to your fdisk command.  That should permit you to set the first sector of the partition to 63.

16

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

That did it! All seems good; Windows boots and Disk Management shows the unallocated space correctly.

Gparted seems a very effective program, but not easily intuitive for the novice! Is there detailed information anywhere on the command-line commands and switches? I haven't found anything in the online Manual.

The next job will be to clone an image of the drive to another HDD via ethernet using Clonezilla. Maybe I'll be lucky and it will all work to plan, but I'm not over-optimistic.

Thanks, both, for the help. I'd have given up long ago without.

Steve.

17

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

Stevejs wrote:

Is there detailed information anywhere on the command-line commands and switches?

There are no command line switches for GParted, but you can pass the device paths of the disk devices you wish to work on.  See GParted Manual - Running gparted from a Command Line

18

Re: [SOLVED]How do I reduce an NTFS system partition with Gparted-live?

I see that you are right, of course, and what I really should have been asking about was options for ntfsresize, which I've found described here.