-1

I want to merge an unused partition with my main partition where the OS is installed (Debian 8).

df -h output:

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       9.9G  2.1G  7.4G  22% /
udev             10M     0   10M   0% /dev
tmpfs           393M  5.3M  388M   2% /run
tmpfs           982M     0  982M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           982M     0  982M   0% /sys/fs/cgroup
tmpfs           197M     0  197M   0% /run/user/0
/dev/vdb         50G   52M   47G   1% /mnt/vdb

So I want to merge /dev/vda1 with dev/vdb.

fdisk /dev/vbd output:

[...]

/dev/vdb: device contains a valid 'ext4' signature, it's strongly recommended to wipe the device by command wipefs(8) if this setup is unexpected to avoid possible collisions.

The /dev/vdb don't have anything of interest and can be removed. On the other hand, /dev/vda1 has important files.

What is the best way to merge them? Thank you.

belyid
  • 331
  • 1
  • 4
  • 14

1 Answers1

1

vdb looks like another disk (a virtual disk) so you can't extend the partition vda1 that is on vda disk to vdb because there are, in fact, different devices.

Some workaround are:

Use LVM

Create a volume group with LVM with vda and vdb as physical device and then create a logical volume that use all the space (both disks).

Actually I don't know if this is a good idea because:

  • You must backup and restore vda1 content in order to create the logical volume (or reinstall the server).
  • You get a "raid0" of vda+vdb (they are virtual disk, so they should be have a redundant backend but...)

Mount vdb where you need space

If you need more space in a specific directory you can mount vdb (that already has an ext4 filesystem) to this path and move the file on the secondary disk.

Tsumi
  • 333
  • 2
  • 8