1 (edited by gedakc 2014-05-16 23:17:52)

Topic: SOLVED: Need help extending recovery partition

https://www.dropbox.com/s/b1c251wjz406azr/screenshot.PNG

Hi,

I need to expand a ntfs Recovery partition from 300MB to 350MB.  How can I safely do this, maintaining the sequence of partitions intact, using GParted given the following scenario:

/dev/sda1     ntfs              Recovery   300.00 MiB   264.52 MiB   35.48 MiB     hidden, diag
/dev/sda2     fat32                              99.00 MiB     29.21 MiB     69.79 MiB    boot
/dev/sda3     unknown                      128.00 MiB                ---                ---     msftres
/dev/sda4     ntfs                                49.48 GiB      12.64 GiB     36.85 GiB    msftdata
unallocated  unallocated                      1.00 MiB                 ---                ---

FYI: The fat32 partition above is an EFI partition, and the unknown partition above is a Microsoft Reserved partition.

I appreciate any suggestions.

Many thanks!

-sul.

2

Re: SOLVED: Need help extending recovery partition

To move space from one partition to another, see Moving Space Between Partitions.

In your situation, all partitions are primary partitions, so you do not need to concern yourself with an extended partition.  You might consider moving the start (left-hand-side) of your sda2 fat32 partition to shrink it by 50 MB, and then grow your sda2 ntfs recovery partition into the newly freed up space.

You might also consider freeing some space from the sda4 ntfs partition as there appears to be much more available.  However this will involve moving more partitions.

In all cases I highly recommend a backup of all your data, and be sure you have the operating system install media available in case you need to restore the boot code.  For instructions on how to restore boot, see the GParted FAQ.

3

Re: SOLVED: Need help extending recovery partition

Thank you for the tip.  I attempted to move the start of the sda2 fat32 partition (left hand side) and unfortunately, it results in the following error:

Libparted bug Found!
Assertion (is != NULL) at ../../../../libparted/fs/fat/ bootsector.c:392 in function fat_info_sector_read() failed.

This partition is the EFI system partition.
Is there any way around this?

I appreciate any help,

Many thanks!

-sul.

4

Re: SOLVED: Need help extending recovery partition

Are you using the latest version of GParted (currently 0.18.0)?

Also the bug appears to be in the libparted library.  When GParted is invoked from the command line (e.g., sudo gparted), it displays the version of libparted in use.  It would be helpful to know the GNU/Linux distribution and version too.

5

Re: SOLVED: Need help extending recovery partition

gedakc wrote:

Are you using the latest version of GParted (currently 0.18.0)?


Thank you again for the reply.  I am booting from the current live cd iso: gparted-live-0.18.0-2-i486.

I will try the amd64 version of the live CD tomorrow and hopefully it will work.


Keeping fingers crossed.

Thanks!

-s.

6

Re: SOLVED: Need help extending recovery partition

If trying the amd64 version, would you be able to test using gparted-live-0.18.0-3-amd64 in the testing branch?

I do not expect a different outcome because both use the same version of libparted, but it is good to test to see.

7

Re: SOLVED: Need help extending recovery partition

gedakc wrote:

If trying the amd64 version, would you be able to test using gparted-live-0.18.0-3-amd64 in the testing branch?

I do not expect a different outcome because both use the same version of libparted, but it is good to test to see.

Thanks again for the reply.  You are right, it resulted in the same error with the amd64 version of the current stable version.

I booted off the test version above and it resulted in a different message when I attempted to resize the FAT32 EFI boot partition. A message popped up saying that the partition needs to be converted to FAT16.  I hit OK and gparted quit (unexpectedly?) and went back to the live CD menu screen.  I re-launched gparted and the partition had infact converted itself to FAT16.

After that, I attempted to resize the converted FAT16 partition and when I hit "Apply", gparted simply quit with no error message.  I do have a backup of the original FAT32 partiton so I will attempt to delete the FAT16 partition and copy the backed up FAT32 back in its place, however I'm open to other suggestions at this time.  I am happy to provide any additional information as needed.

Many thanks!

-sul.

8

Re: SOLVED: Need help extending recovery partition

I just remembered that (lib)parted (and hence GParted) is unable to resize FAT16/32 partitions smaller than 256 MiB.  ;(
See Bug 649324 - failure to move / resize fat32 partitions less than 256 MB in size

9 (edited by sul 2014-05-13 18:05:55)

Re: SOLVED: Need help extending recovery partition

Addendum:  Also, what is peculiar is that the FAT16 partition reports that it has 50MB of unallocated space (see screenshot below), but I cannot use it.  The unallocated space does not appear in the partition table. 

https://photos-5.dropbox.com/t/0/AADQd6bsokS0LeVZ_cMGt6pM5fU0k4gP_VtrLFhOl56jtw/12/2018486/jpeg/1024x768/2/_/0/2/partition.JPG/RW2Ehp8uMkMX81_P-u9TgZO62FgZT2HmTp_23DGZloY

When I attempted a "check" on the partition, it resulted in: "An error occurred while applying the operations".  The details section had the following at the end:

GNU Parted cannot resize this partition to this size.  We're working on it!

thoughts?

Thanks!

-sul.

10

Re: SOLVED: Need help extending recovery partition

gedakc wrote:

I just remembered that (lib)parted (and hence GParted) is unable to resize FAT16/32 partitions smaller than 256 MiB.  ;(
See Bug 649324 - failure to move / resize fat32 partitions less than 256 MB in size


ouch! Many EFI boot partitions are smaller than 256MB. Would it make sense to try an older version of gparted? 

Thanks!

-sul.

11

Re: SOLVED: Need help extending recovery partition

Unfortunately older versions of (lib)parted (and hence GParted) do not address the problem.

The issue with the file system taking up less space than the partition can be manually fixed with a tool such as gdisk, but you need to be extra careful to not make the partition size smaller than the file system.

This still doesn't get around the issue of moving the partition, which could also be performed manually.

12

Re: SOLVED: Need help extending recovery partition

gedakc wrote:

Unfortunately older versions of (lib)parted (and hence GParted) do not address the problem.

The issue with the file system taking up less space than the partition can be manually fixed with a tool such as gdisk, but you need to be extra careful to not make the partition size smaller than the file system.

This still doesn't get around the issue of moving the partition, which could also be performed manually.

Thank you!  I restored the FAT32 EFI partition from backup and now I will look into other tools including gdisk to try and manipulate this partition.  My goal is to resize this FAT32 EFI partition by 50MB at the left hand side and then use the unallocated space to expand the first recovery partition.   I remain hopeful.

Thanks for all the help!

13

Re: SOLVED: Need help extending recovery partition

'Glad to be of help.  smile

When you do arrive at a solution, please consider posting how you addressed the problem so that others with similar challenges will benefit from your knowledge.

14

Re: SOLVED: Need help extending recovery partition

gedakc wrote:

'Glad to be of help.  smile

When you do arrive at a solution, please consider posting how you addressed the problem so that others with similar challenges will benefit from your knowledge.

Yes, I intend to.

Thanks!

-sul.

15

Re: SOLVED: Need help extending recovery partition

gedakc wrote:

'Glad to be of help.  smile

When you do arrive at a solution, please consider posting how you addressed the problem so that others with similar challenges will benefit from your knowledge.

Hi,

Here are the steps to my solution:

1. Procure a second disk as a sandbox (/dev/sdb)
2. Copy the ntfs recovery partition /dev/sda1 on to /dev/sdb as /dev/sdb1
3. Extend /dev/sdb1 from 300MB to 350MB
4. Copy the FAT32 EFI boot partition /dev/sda2 to /dev/sdb as /dev/sdb2
5. Create a new 128MB unformatted placeholder on /dev/sdb as /dev/sdb3
6. Copy the ntfs OS partition /dev/sda4 on to /dev/sdb as /dev/sdb4

At this point partitions that can be handled by gparted have been copied to the other disk, except for the 128MB unknown partition, which is really a Microsoft Reserved partition (gparted cannot copy this).  So these are the steps to copy the 128MB Microsoft Reserved Partition:

7. Quit Gparted and launch Terminal
8. Use dd to copy the /dev/sda3 to /dev/sdb3 using the following command:  sudo dd if=/dev/sda3 of=/dev/sdb3 bs=4096 conv=notrunc,noerror

At this point, all partitions are copied to the second disk /dev/sdb.

10.  Delete all partitions on the original disk (/dev/sda).
11.  Copy partitions from the second disk to the original. Once you get to the Microsoft Reserved partition /dev/sdb3, quit gparted and use dd in terminal again: sudo dd if=/dev/sdb3 of= /dev/sda3 bs=4096 conv=notrunc,noerror
12. Once all partitions are back on to the original disk (/dev/sda), configure the partition types using gdisk using the transform command (t).  The partition types are:

/dev/sda1: 2700 (Windows Recovery)
/dev/sda2: ef00 (EFI System)
/dev/sda3: 0c01 (Windows Reserved)
/dev/sda4: 0700 (Microsoft basic data)

At this point, the partitions are all how they need to be, except windows will not correctly boot because the windows boot loader is probably corrupt due to relocation of the partitions.  To fix the boot loader, here are the following steps:

13. Boot to Windows 2012R2 DVD and select Repair.
14. Press Shift-F10 to get a command prompt
15. Type: bcdedit.  This will list the boot manager and boot loader settings. Take note of the identifier values.  Most likely it is {bootmgr} for the boot manager and {default} for the boot loader.

Now we need to fix the boot manager and boot loader as follows:

16. bcdedit /set {default} device partition=C:
17. bcdedit /set {default} device partition=C:
18. bcdedit /set {default} recoverysequence={8ef1d5b1-5d55-11e3-b9ca-ab1414c0bf77}
19. bcdedit /set {bootmgr} device partition=\Device\HarddiskVolume2
20. Restart.

If everything works, you can detach the second disk and/or save it as a backup in case anything goes wrong.

Hope this helps someone else with a similar issue.

Thanks,

-sul.

16

Re: SOLVED: Need help extending recovery partition

Thank you sul for reporting back with how you solved the problem.  smile

I edited the initial post, on you behalf, to prefix SOLVED in front of the title.  This can help others searching for answers to similar questions.