0

I have a VPS which was installed by my hosting provider. Recently I ran out of space on the original 100GB drive and so they have now allocated an additional 100GB drive to me.

I would like to expand the partition over the new drive so that the server thinks it has a 200GB drive at its disposal.

I have done a number of searches and lots of guides talk about setting up LVMs. I'm not sure whether this applies to me because I have no idea how my server was originally partitioned.

The server is running Ubuntu 16.04 LTS. I only have SSH access to it.

Here is some output that may be relevant:

parted:

GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print all
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system     Name                  Flags
 1      1049kB  538MB   537MB   fat32           EFI System Partition  boot, esp
 2      538MB   1038MB  500MB   ext4
 3      1038MB  3038MB  2000MB  linux-swap(v1)
 4      3038MB  107GB   104GB   ext4


Model: Msft Virtual Disk (scsi)
Disk /dev/sdb: 107GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  107GB  107GB  primary  ext3

I do know that /dev/sdb is the new drive and it is entirely empty and unused. The partition was created just while fiddling. If it needs to be deleted/erased/removed, it can be easily.

fdisk -l:

Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 03D5D2D0-6699-4DC6-9D52-986BC6F711FC

Device       Start       End   Sectors  Size Type
/dev/sda1     2048   1050623   1048576  512M EFI System
/dev/sda2  1050624   2027519    976896  477M Linux filesystem
/dev/sda3  2027520   5933055   3905536  1.9G Linux swap
/dev/sda4  5933056 209713151 203780096 97.2G Linux filesystem


Disk /dev/sdb: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x82a7d10f

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdb1        2048 209715199 209713152  100G 83 Linux

This guide talks about volume groups. When I run vgdisplay nothing displays. Many other guides use gparted, which of course, I don't have access to over SSH.

I imagine that this is not a difficult issue to solve, but being inexperienced with partitioning drives in Linux and in a VPS environment that I don't have any control over, I'm loathe to experiment without at least having some guidance from someone who knows what they are talking about.

Philip
  • 630
  • 5
  • 8
  • 18
  • Your server was not installed with volume groups, so it's not possible for you to extend to the second disk. You need a local console and booting from a rescue disc to do anything that would help you. The only thing you can do with the second disk is to mount it in a place where it helps you most. – Gerald Schneider Jan 19 '18 at 11:21
  • I was worried that this would be the result... Thanks for the feedback, @GeraldSchneider. – Philip Jan 19 '18 at 11:22
  • Another option would be to use lvm to create the new disk, migrate your data to it, mount it where it needs to be, shrink your original disk to a sufficient size for your OS, then add the remaining space on the primary disk to the new lv you created earlier. Obviously it should go without saying that spanning a volume across two disks with no redundancy is a BAD IDEA. JBOD raid arrays are not used very frequently for this reason, unless the data on them is genuinely disposable or is backed up elsewhere then consider another route. – Alex Berry Jan 19 '18 at 16:10
  • Thanks, @AlexBerry. Your comment is valid provided we assume that we are referring to two physical hard disk drives. As mentioned above, this is in a VPS environment and these two virtual drives are very likely on some form of RAID in real life. – Philip Jan 20 '18 at 08:11
  • If I was you, I would ask the provider if it was possible to extend your current drive to 200 GB, and then simply edit the partition table so that your 4th partition would fill all the new space, and then use `resize2fs` to extend your filesystem to use the new space. – Tero Kilkanen Jan 20 '18 at 12:43
  • @TeroKilkanen Which, of course, I have done. And which, of course, they've declined to do. – Philip Jan 22 '18 at 04:57

0 Answers0