[Remix OS Player] vlc33:
Objective:

- Increase userdata-qemu.img qcow2 compressed (ext4) filesystem image

Prerequisites:

- Remix OS player installed in a Windows machine

- Virtual Box 5.1+ installed with a Linux Virtual Machine (Debian 9)

- Virtual Box guest additions installed (see PD at bottom for how to do it)

- Virtual Box shared folder named Remix_OS.avd to [drive:]\RemixOSPlayer\remixemu\avd\Remix_OS.avd

- Be root ($ su -) or prefix all commands by sudo (if you are in the list)

Procedure:

Install qemu-utils package

root@debian:~# apt-get install qemu-utils

Verify you have access to Windows directory containing the compressed disk imagefile to grow

root@debian:~# mkdir /tmp/Remix_OS.avd
root@debian:~# mount -t vboxsf Remix_OS.avd /tmp/Remix_OS.avd

root@debian:~# cd /tmp/Remix_OS.avd ; ls
cache.img config.ini emulator-user.ini hardware-qemu.ini userdata-qemu.img

See what is the actual size of the image (4GB)

root@debian:~# qemu-img info userdata-qemu.img
image: userdata-qemu.img
file format: qcow2
virtual size: 3.8G (4089446400 bytes)
disk size: 1.2G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false

Resize the image (just image headers not the file system) (ex. add 4GB more)

root@debian:~# qemu-img resize userdata-qemu.img +4G
Image resized.

Verify the new size of the image (8GB)

root@debian:~# qemu-img info userdata-qemu.img
image: userdata-qemu.img
file format: qcow2
virtual size: 7.8G (8384413696 bytes)
disk size: 1.2G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false

Mount the image as a 'block device' in Linux (/dev/nbd0)

root@debian:~# modprobe nbd max_part=63 <- must do this
root@debian:~# qemu-nbd -c /dev/nbd0 userdata-qemu.img

Required by resize first do a file system check and say Yes to corrections

root@debian:~# e2fsck -f /dev/nbd0
e2fsck 1.42.12 (29-Aug-2014)
Paso 1: Verificando nodos-i, bloques y tamaños
Nodo-i 7, i_size es 163631104, debería ser 167849984. Arreglar
? si
Paso 2: Verificando la estructura del directorio
Paso 3: Revisando la conectividad de directorios
Paso 4: Revisando las cuentas de referencia
Paso 5: Revisando el resumen de información de grupos

data: ***** EL SISTEMA DE FICHEROS FUE MODIFICADO *****
data: 1647/218240 ficheros (9.5% no contiguos), 208042/998400 bloques

Verify size of the file system (4GB = 4K x 998400)

root@debian:~# e2fsck -v /dev/nbd0
e2fsck 1.42.12 (29-Aug-2014)
data: limpio, 1647/218240 ficheros, 208042/998400 bloques

Actually resize the file system to occupy all available space (now 8GB)

root@debian:~# resize2fs /dev/nbd0
resize2fs 1.42.12 (29-Aug-2014)
Cambiando el tamaño del sistema de ficheros en /dev/nbd0 a 2046976 (4k) bloques.
The filesystem on /dev/nbd0 is now 2046976 (4k) blocks long.

Verify size of the file system (8GB = 4K x 2046976)

root@debian:~# e2fsck -v /dev/nbd0
e2fsck 1.42.12 (29-Aug-2014)
data: limpio, 1647/443520 ficheros, 222227/2046976 bloques

Just to re-verify with filesystem tools

Mount the filesystem (of the block device)

root@debian:~# mkdir /mnt/mnt
root@debian:~# mount /dev/nbd0 /mnt/mnt

Print filesystem characteristics

root@debian:~# df -h /mnt/mnt
S.ficheros Tamaño Usados Disp Uso% Montado en
/dev/nbd0 7,7G 751M 7,0G 10% /mnt/mnt

Unmount file system and block device to free the file

root@debian:~# umount /mnt/mnt
root@debian:~# qemu-nbd -d /dev/nbd0
/dev/nbd0 disconnected
root@debian:~# umount /tmp/Remix_OS.avd

- - - -

PD: Install VirtualBox Guest Additions in Linux VM

On VBox do Tools | Insert Guest Additions CD Image

Note: in VirtualBox v5.1 and 5.2 there is a link in the download page to get a patched Guest Additions iso images, use it instead of the default one, ther tap the CD icon at the bottom of the virtual machine screen and look for it once downloaded.

Then you find on /media/cdrom0/ the disks content

Usually cannot run direcly VBoxLinuxAdditions.run because automatic mount for user cdrom image does not allow file execution.

So you have to copy the file VBoxLinuxAdditions.run to /tmp for example:

#Install first the prerequisites for Guest Additions

$ su -
# apt-get install build-essential module-assistant
# m-a prepare

# cp /media/cdrom0/VBoxLinuxAdditions.run /tmp
# cd /tmp
# chmod 755 VBoxLinuxAdditions.run
# ./VBoxLinuxAdditions.run

Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.14 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Removing installed version 5.1.12 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Building Guest Additions kernel modules.
vboxadd.sh: You should restart your guest to make sure the new modules are actually used.
vboxadd.sh: Starting the VirtualBox Guest Additions

You may need to restart the Window System (or just restart the guest system)
to enable the Guest Additions.

# reboot