r/linuxquestions • • 4d ago

Support How can i make my home folder a dedicated partition?

I have Linux Mint on a 1000GB internal ssd. I want to somehow make my home folder a dedicated partition. The problem is I have 150GB of free space remaining on the disk and my home folder is 350GB.

7 Upvotes

24 comments sorted by

6

u/Weary-Bowl-3739 4d ago

You must have a backup for this, but if you have only space for one data backup, you can do this:

Create the partition. 

Move as much data there as possible. 

Decrease the size of the main partition. 

Increase the home partition 

Repeat until finished 

The dotfolders go last and are not moved but copied. (at least if not too big) 

Change the fstab to mount the home 

If this is successful, comment out the line from fstab, restart, clean up the rest from the home, comment in the line restart. 

1

u/NomadJago 4d ago

I was actually thinking of this idea this morning, wondering if it was doable. Might give it a try. I also just ordered a 2TB ssd to at some point replace my current 1TB ssd that has Linux on it, that would solve the free space issue.

3

u/joe_attaboy 4d ago

If the new drive is coming, don't do anything on the old one yet.

What u/Weary-Bowl-3739 described is the correct routine. But if you're going to replace the smaller SSD with a bigger one, you can just set the partitioning up the way you like from the start. I always do what you're trying to do now when I do an installation: one system partition, a second for /home and the rest for whatever purpose I'm using the system.

If you can't wait, that's fine, but if you can, do it then.

1

u/NomadJago 4d ago

I can wait. I have about 10 days until a 2TB ssd I ordered arrived, so I have time to plan how I will set up partitions. I don't recall on a Linux Mint installation being given the choice to specify partitions, I hope that is there when I need to set it up. I remember doing that years and years ago when installing some other distro.

2

u/joe_attaboy 4d ago

There will be a step in the process where you will be directed to look at and set up partitions. You won't miss it. When you reach that stage, I would advice to select the "Manual" option. This will allow you to choose the size and position of the partitions on the new drive. Do root (/) first, then /home, then whatever you want to do with the rest of the space.

2

u/NomadJago 4d ago

Thank you. Sounds like choosing the size of /home will be critical. I want to plan for future needs of /home. The main space thief of /home is a wine prefix that will hold large files for music composing.

1

u/Weary-Bowl-3739 4d ago

What u/joe_attaboy says + copy the disc to the new disc with clonezilla (device device) and then adjust the volumes with gparted.

Will you keep both disks in operation? 

1

u/NomadJago 4d ago

no, just the new disk

11

u/Slackeee_ 4d ago
  1. Make a backup copy of your home directory to an external device.
  2. delete the data from your home
  3. repartition the disk, at best from a live medium
  4. adapt the fstab to mount the new partition as your home
  5. Done

If your journey through this ends at 1 because you don't have the possibility to make backup copies then stop fiddling with your system until you have that possibility.

3

u/Always_Hopeful_ 4d ago

You can use gparted running from a bootable media like a USB stick to resize your root partition. If there is free space in the root file system, then you can shrink it down to get the space for the new /home.

However, you still need that backup to be safe.

2

u/rarsamx 4d ago

In these cases I make 2 backups.

1

u/Albano_Ct 4d ago

unless half that 350gb is just cached files or game installs that can be redownloaded, in which case they might not need a full 350gb external drive just to start

0

u/squishblushing 4d ago

u make all that sound way less scary than it is lol

1

u/Slackeee_ 3d ago

It really isn't that scary. The mechanisms and technology behind the procedure are well tested. That doesn't mean that nothing can go wrong (that's why you always make a backup before doing something system-critical like changing partition sizes), it just means it is unlikely that something will go wrong.

1

u/EverOrny 4d ago

it depends on filesystem, it has to allow resize both up and down:

1/create target partition in the free space

2/move data to the target partition

3/the source partition has now some free space

4/prepare source partition for shrinking

5/shrink the source partition

6/expand the target partition

7/repeat steps 2 to 7 until you reach you goal

1

u/rarsamx 4d ago edited 4d ago

It's important to backup before you do ANITHING. (Well, in fact, it's important to backup)

Also, yes, it's better to separate it but, if it's not causing you any issues, wait until you have more experience to do it. Separating /home always has a risk.

With that out of the way. In this case I have at least three options for you.

Listed from easiest for a noob to better but that need more experience.

A) Do the backup of home. Boot with a live inage. Delete the contents of home. Use gparted to resize the main partition. Create a new partition. Copy the backup of home there. Edit /etc/fstab to mount that partition at /home.

B) Boot with a live image. Using Gparted shrink the main partition as much as you can. Create a new partition in the now unallocated space. Move as much as you can from the home partition to the new partition. Now the main partition will have space again. Shrink the main partition. Extend the new partition. Move and repeat until you moved it all. Edit /etc/fstab to mount the new partition under /home

C) (My favourite) Boot with a live image Convert your main partition to Btrfs. Create a subvolume for the root partition /@. Create a subvolume for home /@home. Move the contents of /home to the /@home subvolume. Move the contents of the main partition to /@. Edit /etc/fstab to mount /@ at / and /@home at /home.

The advantage of subvolumes is that they have all the advantages of partitions but share the same space. In top of that, with Btrfs you can do snapshots which simplify rolling back and backups.

1

u/p186 4d ago

I’d like to suggest something (optional). In addition to the good advice already given, I find that using LVM helps when needing to adjust in the future particularly if you need to add another physical disk.

1

u/oshunluvr 4d ago

Without any actual info, it's hard to offer advice. Assuming your disk has enough unused space to hold the contents of /home, you could just boot to GParted Live on a USB and from the live session:

  1. Shrink your current partition to the smallest possible size
  2. Create and format a new partition
  3. Move the contents of /home to the new partition
  4. Edit /etc/fstab in the root file system to mount the new partition at /home
  5. Reboot

Alternately, you could convert to BTRFS and have no need to partition, but at this point that might be more work than the above.

1

u/TomDuhamel 4d ago

Make the partition. Copy all your files to it (don't forget dot files). Add it as a mount in your fstab.

0

u/Prestigious_Wall529 4d ago

With them not having sufficient space they'll need two additional drives. One to boot from to be able to resize partitions, and one to backup/transfer the existing home folder contents.

-2

u/Pterodactyl_Time 4d ago

Im not sure if this is possible. Your home folder is already a subsection of your primary partition. And I don't think you can then create another partition within that.

Can I ask why you want to do this? What are you hoping to achieve?

1

u/NomadJago 4d ago

I have heard that it is much better to have /home its own dedicated partition because it makes it so much easier to backup and restore home instead of having to backup the entire system

1

u/TzmFen 4d ago

its possible.. my /home/ is on a whole separate drive to my OS

1

u/friendlyreminder_ 4d ago edited 4d ago

It's possible and quite simple. Linux doesn't care where files are. You edit /etc/fstab to mount /home on another partition and that's it. You would need to create that partition first though.

The migration can be done on an existing system with the exact same method as on a new install. You just point to where a specific folder is supposed to be in fstab and it'll then be there instead of on the same root partition. You don't even need to reboot.

This simplicity and versatility of file hierarchy being completely abstract has been used in so many different use cases. Folders don't have to exist on a real storage drive, they can exist in ram. Many distros mount /tmp to ram. They also don't have to exist on the same PC. They can exist on another PC and accessed through the local network, or even the open internet.

The versatility goes way further than that. Not only can you mount a folder anywhere, but you can mount anything to a folder. If you want an iso file to be accessed seamlessly as if it was a real folder, well you can. This is where the versatility can get really crazy.