0

I have installed an Ubuntu server on a VMWare workstation with a space of 20GB storage as seen below:

enter image description here

After the installation I've attached another 40GB worth storage to the existing Ubuntu server installation (seen below):

enter image description here

Now I want to add this 40GB to my / (root) directory it mean's I want that my / directory became to 60G , like it will be resize from 20G to 60G (20G + 40G), i don't know what should i do, can any body help me ?

, my df -h result shows;

root@Userver:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        18G  900M   16G   6% /
udev            990M  4.0K  990M   1% /dev
tmpfs           400M  308K  399M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            999M     0  999M   0% /run/shm
none            100M     0  100M   0% /run/user
root@Userver:~#

it must be 60G !

i have no graphic mode, then i can't use Gparted tools, i'm just have ssh access !

Bruno Pereira
  • 73,643
Maziar
  • 1
  • 2
  • 4

3 Answers3

1

It should be possible to resize you VMware disks, instead of adding an extra one, with the installed tools from VMware.

To expand a existing disk use the command:

vmware-vdiskmanager -x 1000GB myDisk.vmdk

where 100GB is the new disk size and myDisk.vmdk is the disk file for your Ubuntu server installation.

Next time you boot your vm the partition size will still be the same, you need to expand it to the new available space.

To check where your / is mounted use the command mount, it will return a line similar to:

dev/sda7 on / type ext3 (rw,noatime,nodiratime)

once you know where your / is mount you can use the command resize2fs as such:

resize2fs /dev/sda7

After the resize is finished you should to a file system check (not recommended while the device is mounted). Of course with any disk operations a disk backup is recommended.

By the way, you should be able to download the Ubuntu LiveCD for desktops and use it in your VM by booting the iso, that does not destroy your current setup and might make you life easier while repartitioning.

Bruno Pereira
  • 73,643
  • i don't understand what you saying , i have 2 hard on my VM and i want to merge that's to 1 hard disk, how can i do that ? can you tell me step by step ? – Maziar Jul 07 '14 at 11:46
  • what should i do?? – Maziar Jul 07 '14 at 12:07
  • I am telling you that there is no reason to do that, why 2 hard disks? You can expand the existing one... – Bruno Pereira Jul 07 '14 at 14:10
  • because i have i hard and it was work good , until "/" is full, now i want to increase "/" directory by adding hard to it, on that ESX that Ubuntu server is located there is no hard, i must add hard from a san ! – Maziar Jul 07 '14 at 14:27
0

You can expand the partition if the disk is now bigger but as you're not using LVM, you have to do this with the partition offline... Which means you need to boot your VM into a Live environment.

I'd personally just download the Desktop ISO, boot the VM to that and then use Gparted to alter the partitions (in a nice graphical way). Apply that and reboot and you should find your VM's sda1 has increased.

Oli
  • 293,335
0

Short answer: You can't do that (have a root partition spanning two volumes) with a normal install (AFAIK). You have a couple of possible solutions:

  1. Reinstall Ubuntu, this time using a LVM installation. You can check the instructions here. As you see it's not straight forward but it is really flexible when it's correctly set up.

  2. Move your 20G hard disk to the SAN. Grow it to 40G using VMWare. Boot your VM using a LiveCD and resize your partition. Remove the local 20G disk from the VM. You will only have 40G but this is the easier way. No need to reinstall or to configure anything inside your VM. As a bonus there is no risk of data loss as your original hard disk is not touched.

  3. Use the new 40G hard disk not as /, but as the directory where most of your date reside. In a server it's likely /var/, in a desktop /home/

Javier Rivera
  • 35,153