-1

I need to add an additional disk on partition root on a vps hosted by OVH.

The lsblk:

# lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda      8:0    0  10G  0 disk 
└─sda1   8:1    0  10G  0 part /
sdb      8:16   0  50G  0 disk 
└─sdb1   8:17   0  50G  0 part 

the df -h:

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       9,8G  2,8G  6,6G  30% /
tmpfs           915M  8,0K  915M   1% /dev/shm

I need to resize sda1 to 60G. Is that possible ? If not, how can I mount sdb1 to root ?

Thanks !

1 Answers1

0

The only way to spawn more than one phisical disk with one filesystem is to use LVM to make a volume that spans more than one physical volume. I'm afraid that for the root filesystem there's no online tool that allows to convert a simple partition into a physical LVM volume and construct from it a logical volume that spawns more than one disk.

On other side, there's a high difference in capacity for the two volumes that makes one think that they will be of different technologies and different speeds, making your system largely unbalanced.

Anyway

In case you insist in making a root filesytem larger and spawn two disks, you first need a third disk with more than 60Gb capacity to make a backup of your root filesystem. First you will install linux on it, and boot from it (you don't need to install everything on that partition, just the tools you are going to use to backup your system and to restore it once finished) You'll then backup your root filesystem by mounting it somewhere in your new system and backup it with tar(1), for example.

Once you have freed all your disks, you'll need to repartition your disks for LVM to be installed there. Construct two physical volumes from your new partitions and then a logical volume spawning them all. Once you have this, you can format your new volume with your new root partition, restore your backup and rerun grub-update to restore your boot menu and be able to boot from the new system.

In my opinion, this is a little trickie, existing disks of 1Tb+ at cheap prices, this seems more a homework assignment than an actual professional problem.

Be careful in all steps, as each can completely trash your system.

Good luck!

Community
  • 1
  • 1
Luis Colorado
  • 10,974
  • 1
  • 16
  • 31
  • We develop a cms, and our clients mostly use OVH vps. This is not homework, I'm just a novice. The client wanted more space for his cms, and bought additional disk. Your solution won't work on a vps, you can't free all disks. I manage to increase the size of his cms by mounting sdb1 on the cms folder. That way the cms use the 50GB instead of the 10GB. Thanks for your help – Anthony Le Luyer Mar 21 '17 at 15:54
  • Yes, you can... in a virtual linux environment, you can have more than two disks, and being it virtual, you can extend the original disk partition to appropiate size and then use the `resize2fs(8)` utility to grow it to full capacity. I don't know if you can do it online, but I think last versions of `resize2fs(8)` allow you to do that on a mounted partition (restricted only to grow it, but this is the case) – Luis Colorado Mar 23 '17 at 08:53