How to increase my `/` of Fedora installed on a virtual box?

0

I used virtualbox4 to create a box(8G disk) and installed a Fedora 16. Soon I found the space is not enough that I can't download anything in ~/download.

I use VBoxManage to increase the disk size to 20G, but I still can't download anything.

After some research(I'm newbie to linux), I realize that the increased disk has not been used. I tried to make / to use it, but failed. Because the result of some commands are not the same as my linux book.

df

cd /
df -h

prints:

[freewind@localhost /]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_fedora16-lv_root
                      3.6G  3.5G  7.7M 100% /
tmpfs                 565M  272K  565M   1% /dev/shm
/dev/sda1             485M   55M  405M  12% /boot
/dev/sr0               49M   49M     0 100% /media/VBOXADDITIONS_4.1.12_77245

fdisk

fdisk -l

prints(thanks to Mike):

[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007bb7a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        1045     7875584   8e  Linux LVM

Disk /dev/mapper/vg_fedora16-lv_root: 3833 MB, 3833593856 bytes
255 heads, 63 sectors/track, 466 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_fedora16-lv_root doesn't contain a valid partition table

Disk /dev/mapper/vg_fedora16-lv_swap: 4227 MB, 4227858432 bytes
255 heads, 63 sectors/track, 514 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_fedora16-lv_swap doesn't contain a valid partition table
[root@localhost ~]# 

I don't know what can I do now. How to let / to use extra 12G space? If it's hard, how can I create an extra partition and mount a new dir /mydev to it?

linux
virtualbox
fdisk
asked on Server Fault Apr 29, 2012 by Freewind • edited Apr 29, 2012 by Freewind

1 Answer

5

First of all you have to run fdisk -l as root not a normal user..

That is a lvm.. so you want to create a new drive and grow the lvm i the OS.. So this will work if you create another drive and linux see's it as /dev/sdb

pvcreate  /dev/sdb
vgextend /dev/mapper/vg_fedora16 /dev/sdb
lvextend -l +100%FREE  /dev/vg_fedora16/lv_root 
resize2fs /dev/vg_fedora16/lv_root 

That is my knowing nothing about your lvm setup and taking a guess.. but that is how your grow a lvm

Also make sure you reboot the VM once you add the disk... or you can try to re-scan

echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host2/scan
answered on Server Fault Apr 29, 2012 by Mike

User contributions licensed under CC BY-SA 3.0