Resize Debian in VirtualBox

Posted by Poni on Server Fault See other posts from Server Fault or by Poni
Published on 2012-11-27T21:15:58Z Indexed on 2012/11/28 5:07 UTC
Read the original article Hit count: 517

I have a VM with one HD of size 3GB and I'd like to enlarge its HD to 7GB.

So I execute this command on the host (while guest is shutdown):

VBoxManage modifyhd debian.vdi --resize 7168

Then I run the guest, Debian 6, and then:

smith@debian6:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             2.8G  2.6G   60M  98% /
tmpfs                  61M     0   61M   0% /lib/init/rw
udev                   57M  160K   57M   1% /dev
tmpfs                  61M     0   61M   0% /dev/shm
smith@debian6:~$ sudo parted /dev/sda print
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 3221MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  3035MB  3034MB  primary   ext3            boot
 2      3036MB  3220MB  185MB   extended
 5      3036MB  3220MB  185MB   logical   linux-swap(v1)
smith@debian6:~$ cat /proc/partitions
major minor  #blocks  name

   8        0    3145728 sda
   8        1    2962432 sda1
   8        2          1 sda2
   8        5     180224 sda5

So, no automatic resizing (detection) of the HD/partition (while VirtualBox, in the host, shows it's 7GB now). Ok...

Then I do:

smith@debian6:~$ sudo resize2fs /dev/sda1 
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 740608 blocks long.  Nothing to do!
smith@debian6:~$ sudo parted
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sda1                                                 
Using /dev/sda1
(parted) resize                                                           
WARNING: you are attempting to use parted to operate on (resize) a file system.
parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs.  We recommend
you use parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
Partition number? 1                                                       
Start? 0                                                                  
End?  [3034MB]?

Here I'm stuck. At the above parted it asks me to resize to 3GB. No point in that, right..

What should I do in order to enlarge this partition?

© Server Fault or respective owner

Related posts about linux

Related posts about debian