Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How keep Home directory in new installing?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Thu Mar 05, 2015 12:53 pm    Post subject: How keep Home directory in new installing? Reply with quote

Due to fatal error - after long time of trying recover X server, still not working -
I am going to re-install Gentoo - one question before:
In this machine I do not have separate partition for Home directory -
Please advise if I can keep all data in Home directory?
Can I create an Home partition and then re-install Gentoo on Bios, Boot and root partitions,
and leave Home partition?
At the moment my partitions are like that:
Code:
fdisk -l

Disk /dev/sda: 153.4 GiB, 164696555520 bytes, 321672960 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe41fdb4a

Device    Boot     Start       End    Blocks  Id System
/dev/sda1           2048      6143      2048  ef EFI (FAT-12/16/32)
/dev/sda2 *         6144    268287    131072  83 Linux
/dev/sda3         268288   4462591   2097152  82 Linux swap / Solaris
/dev/sda4        4462592 321672959 158605184  83 Linux

_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 630

PostPosted: Thu Mar 05, 2015 1:22 pm    Post subject: Reply with quote

Two ideas:

1. You could copy off your home to a USB stick or other device prior to your re-install, and create a partition for your /home during the new installation.

- or -

2. Use something like gparted to shrink your sda4 and edit your partions to create a new partition for home, then copy your files to the new partion. http://gparted.org/livecd.php


Remember to make backup(s)
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10306
Location: Córdoba (Spain)

PostPosted: Thu Mar 05, 2015 6:37 pm    Post subject: Reply with quote

Option 3, since in Gentoo YOU are the partitioner, you can just entirely ignore /home. Portage will not touch it if you don't.

Just boot from the livecd, erase all the directories but /home in your hard driver, then just install Gentoo again as you did the first time.

Then all you need is to make sure that your user name and your UID (/etc/passwd, run "man 5 passwd") match. Or, if you find that too messy, just chown all the files to your new user if you have problems accessing them.

Of course, this doesn't mean you shouldn't backup everything first, in case you mistype something at some point...
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Sun Mar 08, 2015 10:20 am    Post subject: Reply with quote

Since I want to create a separate partition for Home directory, I think the following option more suitable to my present needs:
Quote:
2. Use something like gparted to shrink your sda4 and edit your partions to create a new partition for home, then copy your files to the new partition.

However, please explain why need to shrink sda4 - i.e:root partition that includes Home -
Can I just create new Home partition, using gparted, and move all data to there?

Thanks for all your useful tips
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10306
Location: Córdoba (Spain)

PostPosted: Sun Mar 08, 2015 10:26 am    Post subject: Reply with quote

pmam wrote:
Since I want to create a separate partition for Home directory, I think the following option more suitable to my present needs:
Quote:
2. Use something like gparted to shrink your sda4 and edit your partions to create a new partition for home, then copy your files to the new partition.

However, please explain why need to shrink sda4 - i.e:root partition that includes Home -
Can I just create new Home partition, using gparted, and move all data to there?

Thanks for all your useful tips


You can either boot from a gparted livecd or from another OS, shrink the partition from there to make room for the new partition, and then create it and format it with your favorite OS.

After that it's just a matter of moving files from one partition to the other and mounting them at the right place.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1747

PostPosted: Sun Mar 08, 2015 10:41 am    Post subject: Reply with quote

Quote:

However, please explain why need to shrink sda4 - i.e:root partition that includes Home -
Can I just create new Home partition, using gparted, and move all data to there?
you can, if you have enough space to do that. If you don't have that space, you have to create it and leaving empty space on a hard drive is not a common practice which gets us to the line about shrinking root.

Anyway, you might still consider stuffing your /home into tgz archive on another drive before you trash your partition table. It will store permissions as well, so you're safe in case you fail to match new partitions with old filesystem

Oh, I think we have missed one important point: you already have 4 partitions. You can't create 5th primary, so you will have to find another way. Either extendend partition (I don't like the idea) or reorganize everything on that drive.
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Sun Mar 08, 2015 11:07 am    Post subject: Reply with quote

szatox,

Quote:
Oh, I think we have missed one important point: you already have 4 partitions

Yes - You are right... I have enough space however, I used fdisk instead of gparted in this machine, it is quite risky to use extended...
and I have gparted in other machine and would prefer gparted...
So, I think my simple way to work it out is to shrink and keep Home directory on another machine -
mounting over the network and copy Home archive - and then re-organize the partitions with gparted -
Can you please write here the exact tgz command for archive Home directory? I am not well familiar with tgz...

Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10306
Location: Córdoba (Spain)

PostPosted: Sun Mar 08, 2015 11:16 am    Post subject: Reply with quote

You can use "tar cvpf backup.tar.bz2 /home/dir". The "p" means "preserve ownership and permissions" so that's an important parameter :)

If space is not a problem you might want to use a tar.gz file instead, it will be much faster.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Sun Mar 08, 2015 11:36 am    Post subject: Reply with quote

i92guboj,

Quote:
If space is not a problem you might want to use a tar.gz file instead, it will be much faster.

Do you mean this command instead?
Code:
tar cvpf backup.tar.gz /home/dir



Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Sun Mar 08, 2015 12:59 pm    Post subject: Reply with quote

OK - Now I am running the command with tar.gz and afterword I will start new partitioning with gparted...

Thanks you all
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Sun Mar 08, 2015 1:33 pm    Post subject: Reply with quote

another issue regarding gparted - Now I am going to switch to gparted from the old fdisk partitioning type -
I understand that all the old Gentoo's partitions and data will be lost, but I have also win7 on this hard drive
(I installed it before Gentoo) - Is the new gparted partitioning will delete win7 as well? Or gparted work just on Gentoo/Linux partitions?
If yes - Please inform me how can prevent it?
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”


Last edited by pmam on Sun Mar 08, 2015 2:31 pm; edited 1 time in total
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sun Mar 08, 2015 1:37 pm    Post subject: Reply with quote

pmam wrote:
Do you mean this command instead?
Code:
tar cvpf backup.tar.gz /home/dir

Hmm do you not need the z flag to tell it to use gzip (in contrast to j for bzip); or does it know from the extension?
There's J for xz too.

You can lose the v if you don't want to see each filename btw (sometimes more useful in a long workflow.)
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Sun Mar 08, 2015 1:50 pm    Post subject: Reply with quote

steveL,

It was finished and now I have an archive file backup.tr.gz -
hope it is ok - maybe it knows from the extension as you said...

But now I am concerned about win7 - Will it be deleted after new gparted partitioning?
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1747

PostPosted: Sun Mar 08, 2015 2:50 pm    Post subject: Reply with quote

Quote:
maybe it knows from the extension as you said
It does recognize compression when it's extracting archives, no idea about creating them but it's likely. "p" flag is only necessary when extracting, tar always stores permissions inside archive.

Quote:
But now I am concerned about win7 - Will it be deleted after new gparted partitioning?

It depends on you. It is installed on some partition, do you know which one is it? It's the one yo should not touch :) It also most likely uses MBR, so you don't want to install bootloader there, install it on linux partition instead (if you install it at all).
So... It's up to you whether you wipe that windows or not.
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Sun Mar 08, 2015 3:23 pm    Post subject: Reply with quote

szatox,

In order to get smaller file I finally decided to tar again with the origin i92guboj's command:
Code:
tar cvpf backup.tar.bz2 /home/dir

Now - Can you please inform me the exact command to extract it with the permission...

Quote:
It's the one you should not touch :)

Thanks for this tip
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1747

PostPosted: Sun Mar 08, 2015 3:35 pm    Post subject: Reply with quote

cd /home
tar xpf <path to your compressed home dir archive>

yw :)
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 630

PostPosted: Sun Mar 08, 2015 6:06 pm    Post subject: Reply with quote

By the way,

tar with 'z' uses gzip to compress / decompress
tar with 'j' uses bzip2 to compress / decompress

tar does not use the file name to determine compression type. If you leave off the compression flag, it's a straight tar archive with no compression. If you do that for both the 'c' and the 'x' commands, tar is none-the-wiser, your file is not compressed and it just works with no compression; no real harm done, just a bigger file.

You can test with 'file backup.tar.bz2'

It should say, either "POSIX tar archive (GNU)", or "bzip2 compressed data ..." (if you actually used the 'j' flag).
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10306
Location: Córdoba (Spain)

PostPosted: Sun Mar 08, 2015 6:19 pm    Post subject: Reply with quote

You are right, I was aware of that but typed it wrongly.

You can omit z and j when uncompressing (it wasn't always that way, by the way), but when compressing you need to specify it.

It's also true that -p is only needed when uncompressing but I tend to always write it for some reason.

Sorry for the confussion.

As for gparted... it's a visual tool. You can delete the partitions you want, and for most fs's you can resize them without losing data. It's up to you.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10306
Location: Córdoba (Spain)

PostPosted: Sun Mar 08, 2015 6:20 pm    Post subject: Reply with quote

i92guboj wrote:

As for gparted... it's a visual tool. You can delete the partitions you want, and for most fs's you can resize them without losing data. It's up to you.


However, given that you don't have room to create another primary partition, you will need to convert the 4th partition (or whatever) to "extended" type, which in turn means you will need to erase its content.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10306
Location: Córdoba (Spain)

PostPosted: Sun Mar 08, 2015 6:23 pm    Post subject: Reply with quote

Also, if you want extra compression you can just tar cvf and then use 7z on that file.

I don't recommend using 7z directly because as far as I know it won't preserve permissions.

It's a handy option if you truly want the smaller possible file size to put it into cds or something...
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Sun Mar 08, 2015 8:13 pm    Post subject: Reply with quote

After this topic I finally will know how to compress files :)
Here what I see so far:
With bzip2 (file.tar.bz2) I get smaller compressed file than gzip (file.tar.gz).
For tar bzip2 this command is needed:
Code:
tar  jcvf backup.tar.bz2 /home/dir

BTW: I see that can write command with or without '-' before options.
To extract bzip2 with permissions:
Code:
cd /home
tar jxvpf backup.tar.bz2


To close this issue - tar is using for multiple files & directories - But a single file can be compressed by:
Code:
bzip2 file.txt
and extract:
Code:
bzip2 -d file.bz2

BTW: I do not see 'p' option for single compressed file...

Hope all above are right - If not, please correct me :)

Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Mon Mar 09, 2015 5:21 am    Post subject: Reply with quote

pmam wrote:
After this topic I finally will know how to compress files :)
Here what I see so far:
With bzip2 (file.tar.bz2) I get smaller compressed file than gzip (file.tar.gz).

If you did not compress using z then your tar.gz is just a .tar with a misleading extension.

So long as that's clear.

Good luck :-)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum