I had the same problem where I had moved a disk, and replaced the original with a symlink. This works OK afterwards, but you run into problems with the 'modifyhd' command, as that apparently canonicalizes the path to the vdi-file when working with it. This makes it looks like you're trying to add a new disk with the same UUID but on a different path - or something like that.
There was two problems:
The disk had to be removed from the VM that used it, but then also "from the VirtualBox list of hdds". This was fixed with 'closemedium' command, which removes it from that list.
The disk to be resized was a "fixed disk" instead of "dynamic", and only dynamic disks can be resized. That was fixed with a 'clone' command (the clone is dynamic), and then resize the resulting disk.
This is my log for how it was done. Do notice that I am not at any point running as root, except when I afterwards do the resize of the partition and filesystem.
REMOVE THE ASSOCIATION TO THE DISK FROM VM.
PROBLEM STILL PERSISTS:
virt_box@TestBox:~/VirtualBox VMs/TestInception 64 bit$ VBoxManage modifyhd TestInception\ 64\ bit.vdi --resize 8192
VBoxManage: error: Cannot register the hard disk '/datadisk/VirtualBox VMs/TestInception 64 bit/TestInception 64 bit.vdi' {6cd99209-e4db-4178-a6c2-53f9581b1fad} because a hard disk '/home/virt_box/VirtualBox VMs/TestInception 64 bit/TestInception 64 bit.vdi' with UUID {6cd99209-e4db-4178-a6c2-53f9581b1fad} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 178 of file VBoxManageDisk.cpp
Ah, the disk is still "in the system":
virt_box@TestBox:~/VirtualBox VMs/TestInception 64 bit$ VBoxManage list hdds
UUID: ba58276a-bbe1-4354-8ae5-246bdac390c8
Parent UUID: base
Format: VDI
Location: /home/virt_box/VirtualBox VMs/TestInception 32 bit/TestInception.vdi
State: locked write
Type: normal
Usage: TestInception 32 bit (UUID: a693ac62-7caa-4f11-9d00-51d3a149f5f7)
UUID: 6cd99209-e4db-4178-a6c2-53f9581b1fad
Parent UUID: base
Format: VDI
Location: /home/virt_box/VirtualBox VMs/TestInception 64 bit/TestInception 64 bit.vdi
State: created
Type: normal
Remove/delete the disk from the VirtualBox disk list ("closemedium"):
virt_box@TestBox:~/VirtualBox VMs/TestInception 64 bit$ VBoxManage closemedium disk 6cd99209-e4db-4178-a6c2-53f9581b1fad
virt_box@TestBox:~/VirtualBox VMs/TestInception 64 bit$ VBoxManage list hdds
UUID: ba58276a-bbe1-4354-8ae5-246bdac390c8
Parent UUID: base
Format: VDI
Location: /home/virt_box/VirtualBox VMs/TestInception 32 bit/TestInception.vdi
State: locked write
Type: normal
Usage: TestInception 32 bit (UUID: a693ac62-7caa-4f11-9d00-51d3a149f5f7)
Try the resize again:
virt_box@TestBox:~/VirtualBox VMs/TestInception 64 bit$ VBoxManage modifyhd TestInception\ 64\ bit.vdi --resize 8192
0%...
Progress state: VBOX_E_NOT_SUPPORTED
VBoxManage: error: Resize hard disk operation for this format is not implemented yet!
DAMN, "fixed-size" DOESN'T WORK! 'clonehd' to the rescue, as that leaves a 'dynamically allocated' cloned disk:
virt_box@TestBox:/datadisk/VirtualBox VMs/TestInception 64 bit$ VBoxManage clonehd TestInception\ 64\ bit.vdi TestInception\ 64\ bit-cloned.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: 8e237500-173b-401a-9e63-9e64da110da9
NOW DO THE RESIZE (instantanious):
virt_box@TestBox:/datadisk/VirtualBox VMs/TestInception 64 bit$ VBoxManage modifyhd --resize 8192 TestInception\ 64\ bit-cloned.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
THEN ATTACH TO SOME VM, FOR RESIZING. This is done as root. Assumes that you only have one partition and possibly swap.
# fdisk /dev/sdb # <- The extra disk, just attached to be resized
// The procedure looks like this:
// m - print help
// p - print table
// d ... - delete partition (delete both if you have root and swap)
// n - new partition (create root/first partition starting on exact same sector as before, typically 2048, but ends on last, or last minus swap)
// ... n.. (.. then add the swap partition. Calculate how many sectors using original table)
// t - change type of partition (swap partition, if any, to 82 - not 83 which is "normal Linux").
// w - write partition table (write out, with the resized partition)
# e2fsck -f /dev/sdb1
e2fsck 1.42.5 (29-Jul-2012)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 99918/122160 files (0.3% non-contiguous), 471032/487936 blocks
# resize2fs /dev/sdb1
resize2fs 1.42.5 (29-Jul-2012)
Resizing the filesystem on /dev/sdb1 to 1965824 (4k) blocks.
The filesystem on /dev/sdb1 is now 1965824 blocks long.