Monday, April 2, 2018

hard drive - VIRTUALBOX RESIZE PARTITION | Archlinux | guest not recognizing new increased disk size


UPDATED-STATEMENT: 20190206@094017@WED Post created
UPDATED-STATEMENT: 20190208@153938@FRI Attempted to resize partition but unable to get more than 8GB for root or sda2 in my case
UPDATED-STATEMENT: 20190211@133954@MON Attempted to Rescan disk size, but get permission denied


Host: win7-x64-6.1.7601
Host-storage: 500gb with 250gb freespace
Virtualbox-version: 6.0.4.128413 [corrected]
Guest-os: Arch Linux x86_64
Guest-kernel: 4.20.5-arch1-1-ARCH
Guest-storage: (supposedly 20gb, but 8gb still shown and it's full at root partition)


Disk Size should never be underestimated as it's better to be safe than sorry


You'll learn to be more flexible if you can increase Virtualbox disk size



I've managed to install Archlinux in Virtualbox as a Guest and using Windows 7 as a Host. It was good until I began to run out of space.
This is because i've chosen to use 8gb for my Virtual Size with everything else as typical setup through Virtualbox. So, this means i'm using the normal file.vdi type of Virtual Machine.
The problem is i'm lacking space which began from me trying to Refresh & Update my archlinux via pacman -Syu to install packages but failed.
I did my research on how to get more disk space for my Archlinux and came across 3-steps. These steps include resizing the disk, resizing the partition, & finally resizing the filesystem.
The resizing procedures vary between Virtualbox's Host/Guest. I got stuck after the first step to resize disk and the issue is that I am unable to have Archlinux see my HDD as 20GB as it's still showing 8GB. Why wouldn't my Guest OS see the increased size made by Virtualbox?


I'll explain what i've done so far and need to know the steps to continuing me through getting more disk space on my Archlinux using Virtualbox as a Guest.


PROBLEM



  • The modified disk size isn't recognized in Archlinux after increasing disk size within Virtualbox as it still shows 8GB instead of the increased 20GB

    • How did I increase disk size for my vm-guest in Virtualbox?

      • use virtualboxmanager -> C:\Program Files\Oracle\VirtualBox\VBoxManage.exe modifyhd "path/to/archlinux.vdi" --resize 20000


    • How did I verify disk size for my vm-guest in Virtualbox?

    • How did I verify disk size for my vm-guest in Archlinux?

      • use archlinuxguest -> fdisk -l | grep sda


      • Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
        /dev/sda1 2048 1050623 1048576 512M EFI System
        /dev/sda2 1050624 12560383 11509760 5.5G Linux filesystem
        /dev/sda3 12560384 16777182 4216799 2G Linux swap

      • use archlinuxguest -> df -Th to display root partition running out
        of space which is /dev/sda2


      • Filesystem Type Size Used Avail Use% Mounted on
        /dev/sda2 ext4 5.4G 5.0G 119M 98% /



  • The 2nd-step to increasing disk size in Virtualbox is to resize partition, another issue here is that I can't choose any size that exceeds 8GB limit

    • Prepared to resize partition by disabling swap and deleted partitions sda2-root & sda3-swap while keeping boot partition which is efi for sda1


      • root@archiso~# lsblk
        sda 8:0 0 8G 0 disk
        sda1 8:1 0 512M 0 disk
        sda2 8:2 0 5.5G 0 part
        sda3 8:3 0 2G 0 part


    • Attempted to enlarge sda2-root by removing sda2-root & sda3-swap then tried to create new partition for root but with a larger size this time, but unable to because 8GB is still the limit after resizing the disk


      • root@archiso~# gdisk /dev/sda
        (d 2 d 3)
        (n 2 FIRSTSECTOR blank LASTSECTOR 18G)
        Last sector (1050624-16777182, default = 16777182) or {+-}size{KMGTP}: _




SOLUTION



  • None-so-far


NOTE

  • How do you know that you don't have enough disk space for partitioning when using gdisk?

    • You'll be re-prompted without warning for inputting appropriate partition size regardless of First/Last sectors


  • When using Archlinux-boot-image for recovery or partitioning purposes; then, there's no need to be concerned for unmounting when working with your GPT partitioning scheme

    • I used the archlinuxbootimage when working with hard-drives instead of doing it live on the PC i'm using and have to worry about unmounting and so forth


  • Why did you find out the HDD space in Archlinux by grepping sda using fdisk -l?

    • The output is too much info at least now it's showing what drive I have, how much space is used up by each partition


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...