2

I'm trying to extend my Ubuntu partition by shrinking down my Windows partition. Using Windows Disk Management Tool I've shrinked out 99.67 Gb and now I have it unallocated. I need to add this 99.67 Gb to my Ubuntu root partition.

I'm using GParted and following this tutorial.

Here's what the df command prints out:

➜  ~ df
Filesystem     1K-blocks     Used Available Use% Mounted on
udev             1951080       12   1951068   1% /dev
tmpfs             392684     1040    391644   1% /run
/dev/sda8       50264772 45937836   1750552  97% /
none                   4        0         4   0% /sys/fs/cgroup
none                5120        0      5120   0% /run/lock
none             1963416        0   1963416   0% /run/shm
none              102400       32    102368   1% /run/user
/dev/sda1          98304    29567     68737  31% /boot/efi
shmfs            4194304  1162184   3032120  28% /dev/shm

so it seems that my Ubuntu root partition is sda8.

So, according to the tutorial, in file /etc/grub.d/40_custom I add the new menuentry. Here's how this file looks like:

#!/bin/sh
exec tail -n +3 $0

menuentry "GParted Live ISO" {
    set isofile="/denis/iso/gparted-live-0.27.0-1-i686.iso"
    loopback loop (hd0,8)$isofile
    linux (loop)/vmlinuz boot=live config union=aufs noswap noprompt ip=frommedia findiso=$isofile toram=filesystem.squashfs
    initrd (loop)/live/initrd.img
}

However, I get this error when trying to boot "GParted Live ISO" from Grub: enter image description here and when I press any key to exit, Windows immediately starts to boot.

The iso file gparted-live-0.27.0-1-i686.iso is located in /home/denis/iso/ directory.


Could you please help me to find out what I'm doing wrong here and how to correctly load my GParted Live image from iso?

Update 1

I've investigated a bit and found the location for my iso file in /boot folder from grub, it's (hd1,gpt8)/. Here's the screenshot from Grub console: enter image description here

Here's how my new 40_custom menuentry looks like:

menuentry "GParted Live ISO" {
    set isofile="/boot/iso/gparted-live-0.27.0-1-amd64.iso"
    loopback loop (hd1,gpt8)$isofile
    linux (loop)/vmlinuz boot=live config union=aufs noswap noprompt ip=frommedia findiso=$isofile toram=filesystem.squashfs
    initrd (loop)/live/initrd.img
}

When I boot "GParted Live ISO" menuentry, I receive the following output: enter image description here

  • sda8 should correspond to 'hd0,7', as df counts partitions from 1, grub does from 0. – ridgy Dec 05 '16 at 13:57
  • set isofile="/home/denis/iso/gparted-live-0.27.0-1-i686.iso" – mook765 Dec 05 '16 at 16:48
  • @ridgy this gives me the exact save error except now it says disk 'hd0,7' not found – yakovenko-denis Dec 05 '16 at 20:39
  • Sorry, I was mistaken. Partitions really count from 1... – ridgy Dec 05 '16 at 20:49
  • @ridgy do you have any other ideas on why this error is happening? – yakovenko-denis Dec 05 '16 at 21:04
  • Why are you doing this? Just burn the iso to a disk or usb drive and set your system to boot from that. – terdon Dec 06 '16 at 10:44
  • I typically keep my / partition small. So I have another partition just for ISO. Partition number and path are the major issues, I still often have to correct my entries. http://askubuntu.com/questions/388382/multi-partition-multi-os-bootable-usb/388484#388484 IF your system is UEFI, you also need to be using the 64 bit version of gparted. – oldfred Dec 06 '16 at 19:19
  • @oldfred I've changed my ISO file to the 64 bit version, as you've advised. And I've also corrected the path and now I get another error. Please, see the Update 1 – yakovenko-denis Dec 06 '16 at 19:37

1 Answers1

1

Okay, here's how I finally got this working:

menuentry 'GParted 64-bit ISO' {
  set gfxpayload=text # ~= vga='normal'
  set isofile_abspath='/boot/iso/gparted-live-0.27.0-1-amd64.iso'
  set isofile_devpath="${devroot}${isofile_abspath}"
  loopback loop "(${root})${isofile_abspath}"
  linux '(loop)/live/vmlinuz' boot='live' union='overlay' username='denis' config components noswap noeject toram='filesystem.squashfs' ip='' nosplash findiso="${isofile_abspath}"
  initrd '(loop)/live/initrd.img'
}
  • This makes no sense. $root is not defined and $devroot is not used? – u628898 May 10 '21 at 10:53
  • This doesn't work. The grub error is the following: error: out of memory., then error: no server is specified. and then error: you need to load the kernel first. – Raman Sinclair Jan 30 '23 at 20:57