-   Linux - Newbie (
-   -   How do I add to my main / mount point from my /home? (

wcrandthor 09-19-2012 10:20 AM

How do I add to my main / mount point from my /home?
I'm running OpenSUSE 12.1 within a virtualbox, I've allocated 40GB of space (/dev/sda) for this virtual machine.

I have two partitions set up:
/dev/sda1 (linux-swap) has ~700MB
/dev/sda2 (mount point /) has 5GB
/dev/sda3 (mount point /home) has ~34GB

My /dev/sd2 filled up and I'm only using 5GB from my /home so I want to give some of the extra to /dev/sd2.

How do I do this?
I have GParted and I can see the partitions:
[linux-swap][dev/sda2][dev/sda3(used) dev/sda3(unused)]

I logged in as root and I can unmount /dev/sda3 successfully so that I can make a new partition, or unallocate space from it... but I don't see anyway to combine partitions. Also, I'm concerned that by shifting /dev/sda3 I'm going to screw something up. EX:
[linux-swap][dev/sda2][/new_space_from_sd3][dev/sda3(used) dev/sda3(unused_smaller)]

How can I safely accomplish my goal?

TobiSGD 09-19-2012 10:41 AM

First of all, do not do this from a running system, do this from a live-CD. Download for example the GParted live-CD and mount it to the virtual machines CD drive, then boot the VM from that CD. Now you can easily use GParted to shrink the /home partition and extend the /-partition.
If you really want to merge those partitions you first have to copy the contents of the /home partition to a separate drive, then delete the /home partition, extend the / partition and copy the data back to the /home folder. Keep in mind that you also have to adapt your /etc/fstab in this case.
Tip for the future: You can avoid situations like these with using LVM instead of ordinary partitions.

wcrandthor 09-19-2012 11:08 AM

@TobiSGD - Really appreciate the help. I downloaded the iso and booted from it, works great and I can move around any of the partitions I want now. Which is great. Now the only question I have is, is this safe?

The way I have my partitions right now the /dev/sda2 butts up against the /dev/sda3, so in order to get the free space next to /dev/sda2 I have to move /dev/sda3. Is it possible I will lose the data in /dev/sda3 (home) or is the GParted tool not.. that faulty?

TobiSGD 09-19-2012 11:52 AM

Usually GParted works well. But when you mess with partitions, regardless which tool you use, you should make a backup of your important data first (which you should make periodically anyways).
Since you use Virtualbox is is as easy as making a copy of the .vdi-file or just make a snapshot before taking actions.

All times are GMT -5. The time now is 02:07 AM.