SparkyLinux Forums

Software & hardware support => Newbie questions => Topic started by: poohduck on November 20, 2017, 02:13:56 AM

Title: Moving home to a different partition
Post by: poohduck on November 20, 2017, 02:13:56 AM
I don't fully understand fstab and home folder location.

I have a data partition, sda3. I believe that I have mounted this partition @ /media/sda3 using fstab:

UUID=b9e5953d-c733-4742-a2a5-e1cf75c82a13 /                         ext4         defaults,noatime 0 1
UUID=f3780626-4df9-4569-89ba-3843e5b58ddd swap                  swap        defaults,noatime 0 0
UUID=8e758bfd-88fb-41d2-82a8-b6efe6ba271f /media/sda3    ext4    defaults,noatime 0 0   
tmpfs                                                                             /tmp           tmpfs        defaults,noatime,mode=1777 0 0 w

I would like to put home on sda3. Home right now is /home/basil (I have no idea why) on sda1 (top line of fstab is sda1). How is the current home location configured, and how do I change it?

Thankyou in advance

   
Title: Re: Moving home to a different partition
Post by: penguin on November 20, 2017, 10:58:28 AM
Hmmm...

First I am farway from my Linux Laptop, but I will try to explain you.

very quick:
http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/home.html

/   is your root   (your Linux System)
/home contains user profiles

When You install your Linux (Sparky in these case ) , Installer gives you opportunity to install /home under the same partition of /  or you can choose to use in another partition for your /home.

Lets say: You are installing Sparky. First Scenario : During install you choose:   /  or root will be installed on sda3 ( home under  / ). So in this case you have all your Linux System in sda3

Second Scenario :  During install you choose:   / (root) will be installed on sda3. You choose / home to be in sda4 (for example), but also you can choose other folders to be installed on other partitions.

Said that benefit of having /home in separate partition from / (root) is that when you reinstall your Linux system ( all previous softwares remain in /home becauase you re-format only / (root) ).... In fact I am not very sure for this because some of the programs/software that I have installed are copied under /var/opt or /opt.


I choose /home under / (root) means : all folders under one partition and I use another one partition as storage(downloads)

Before asking here, I would recommend to google for it or watch youtube videos for Linux Calamares Installer.

I am not very sure why you need to move your home to another partition.Anyway look at the follow links:


https://www.maketecheasier.com/move-home-folder-ubuntu/
https://www.tecmint.com/move-home-directory-to-new-partition-disk-in-linux/
https://askubuntu.com/questions/5484/how-can-i-move-my-home-directory-to-another-partition-if-its-already-part-of-t

   
Title: Re: Moving home to a different partition
Post by: poohduck on November 20, 2017, 11:08:23 AM
Thanks. I want to keep data separate from the os, something I've always done with windows. Easier for rebuilding or recovery ie if I make an image file of a healthy os partition, if something goes wrong I can simply image back the healthy os image file, the data partition never gets touched. For data security, I just run regular backups, because data is always changing.

Ultimately I also want to relocate the var folder as well to the the data partition. It just seems like a logical and easy setup.
Title: Re: Moving home to a different partition
Post by: penguin on November 20, 2017, 12:48:46 PM
Ok You know.

As I said. I use /home under / (root). I use regular backups to another partition.
I use ddrescue utility or gdiskdump or lucky backup or qt4-fsarchiver for backup.

I something goes wrong ,boot your laptop/PC from a bootable Linux USB and restore your Sparky Linux on couple of minutes. You should have these utilities also in your boot Linux USB.
The best way is to have /double partition boot/, another OS installed in another partition.So you can backup and restore your Sparky from outside; (from this second OS that can be another Linux OS or Windows OS.)

Hope it helps
Title: Re: Moving home to a different partition
Post by: poohduck on November 21, 2017, 12:53:36 AM
Is root on sda1 (where the os is installed)? I want to put home, var etc on sda3. I am quite capable in windows, but with linux I am a newbie :) . I know what I want to do, but mostly don't know how to do it.
Title: Re: Moving home to a different partition
Post by: paxmark1 on November 22, 2017, 04:20:18 AM
Yes, data and os in separate partitions  is more sensible.   Feel free to add comments to your fstab  via # preceding the comment.  I comment which /dev/blah# corresponds to the uuid

You will get better responses if you highlight in the tags for code. Just higlight and use the # button   

For Me
  GNU nano 2.8.7         File: fstab                                         

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

proc /proc proc defaults 0 0
# /dev/sda1
UUID=f817a267-6199-424f-8f2e-c731faaed6c0 / ext4 relatime,errors=remount-ro 0 1
# /dev/sda3 home
UUID=5cf442f8-ffc4-4e6d-8fd1-15960bcb019b /home ext4 relatime 0 0
# /dev/sda2
UUID=71bdab69-9c23-4474-989e-f965c73614ed none swap sw 0 0
# cdrom
/dev/cdrom /media/cdrom udf,iso9660 user,noauto,exec,utf8 0 0


man blkid will give you infor on blkid  running blkid (as root - or put sudo before as "basil")  to find out uuid's and /dev/blah#
blkid
/dev/sda1: UUID="f817a267-6199-424f-8f2e-c731faaed6c0" TYPE="ext4" PARTUUID="0a1b7d42-01"
/dev/sda2: UUID="71bdab69-9c23-4474-989e-f965c73614ed" TYPE="swap" PARTUUID="0a1b7d42-02"
/dev/sda3: UUID="5cf442f8-ffc4-4e6d-8fd1-15960bcb019b" TYPE="ext4" PARTUUID="0a1b7d42-03"
/dev/sdb1: UUID="0d181bb8-6439-445d-bf53-0cb04b1da555" TYPE="ext3" PARTUUID="fdab0085-01"


It is standard to put /   ## root
into the first partition  /dev/sda1 usually.  /swap if used wil go into a small section
home  would be /home   It will then be populated by all users - possibly user basil in your case. 

You can use the gui of gparted to get a visual view of your partitions.  There is lots of info out there on fstab.

peace out
Title: Re: Moving home to a different partition
Post by: poohduck on November 22, 2017, 06:37:33 AM
OK, I think I get it. I've lost my desktop previousl trying to change location, so this is where I'm wary (before actually doing it :) )

Right now home is at /home/basil on sda1. So, do I have to copy /home/basil/*.* (current home location on sda1) to /media/sda3/home before making that fstab change?

Or, put another way, should I create a home folder on current mnt point for sda3 eg /media/sda3/home. Then use rsync to copy all from current home to future home (copy /home/basil/*.* to /media/sda3/home). Then when I change fstab from /media/sda3 to /home in my feeble mind, all should be well. Is it that simple? (I'm laughing)
Title: Re: Moving home to a different partition
Post by: penguin on November 22, 2017, 09:16:33 AM
poohduck.

As I said. I have my home under / root.
I can make a test with me home , as is explained in the links on my previous post.
But... Simply. Install another Linux in another partition or prepare a Boot USB Linux and use it to make backup and restore by utilities that I mentioned. Make backup from outside Sparly. dd utilities makes exact backup of partitions (also UUID).
So simply. You run an outsider Linux (in bootable usb or on another partition) and from them you make Sparky backup/restore to/from another partition.
Title: Re: Moving home to a different partition
Post by: poohduck on November 23, 2017, 01:02:13 PM
It looks like it's just not meant to be done. I do it and can't log in; have to log in as root and undo everything. What a nightmare - nothing comes easy here. It's the same with puppy - try to get it to run from a full install and shit starts to happen. It really looks to me like I just have to accept what the (illogical) system is now. Thankyou for trying to help
Title: Re: Moving home to a different partition
Post by: poohduck on November 24, 2017, 07:10:36 AM
OK, I think I'm beginning to understand more. I have successfully moved var to it's own partition. I didn't really want to do that, but it looks as though that's the only way because of fstab? Anyway, after reading more on var, I've probably made it too small (1gb). I pinched the space from redundant space; I didn't need so much. So I think I'll have to keep an eye on log sizes and del them whenever; is it that simple?

There were a couple of things I didn't understand earlier. The mnt and media foders seem mostly pointless for var and home. So, I'll have a go at home :) I think what isn't really explained anywhere, is that var has to be mounted at /var and home has to be mounted at /home. For example I have sda4 partition for var and sda3 partition for home. I mount /dev/sda4 /var and /dev/sda3 /home. And, those folders have to exist in those locations. I'm sure you know all this penguin, this is just for other newbies who might to trying to get their heads around it. I did use the live boot usb to do some of the steps as you advised :)
Title: Re: Moving home to a different partition
Post by: bardo on November 25, 2017, 09:21:12 PM
Hello,

i guess, i am way too late, but still:

As i look at it, there are several things to consider here:

I am doing this, usually because some user is exceeding its free space on the initial partition, and it really is no big deal, if you know your commands.
Have you been successful?
Title: Re: Moving home to a different partition
Post by: poohduck on November 28, 2017, 02:34:13 AM
Yes, you pretty much covered everything that took me ages to figure out, simply because I didn't understand basic things with linux :)

I did use a boot iso, and also used the root login for the same purpose. I can see the big picture now - before I was following instruction without seeing the big picture, not knowing how linux worked.

Thanks for your post. I'm sure there will be other newbies who appreciate this :)

Title: Re: Moving home to a different partition
Post by: bardo on November 28, 2017, 03:17:33 AM
Thanks poohduck for letting me know. And do not worry: This is not an everyday experience, only admins have to take care of it on a regular basis.
And whatever you went through let you learn a clearer (big) picture in your mind, and you will benefit from it in different (currently unknown) places.
All of us are taking steps on the same stairway, only at different places. And once you got past one, usually, you don't have to look back ever again, you just go ahead. :-)
Well done.

Have fun and enjoy.
bardo