You are not logged in.
Pages: 1
I had an order craving recently, and wanted to move my home directory to a separate partition. My hard disk is currently divided like this:
S.ficheros Tamaño Usado Disp Uso% Montado en
/dev/sda5 51G 35G 14G 73% /
none 941M 88K 941M 1% /dev
none 941M 0 941M 0% /dev/shm
/dev/sda8 219G 128G 92G 59% /homefedora
/dev/sda6 22G 22G 0 100% /fedora
/homefedora was an old partition I used to have on Fedora for the same porpouses that those I want now. The deal would be to take sda8 free space, put it on sda6, having previously formated it and being my new /home partition, and then move everything from /home and /homefedora to it. Finally, merge sda8 to sda6
I think that Gparted can do most of those things, but my question is about changing /home path and the precautions I should have when doing it.
Thanks for your time!
Last edited by JMO (2009-12-20 19:22:00)
Offline
Do a search on the forums and the web and you will see that it's quite easy, mostly its just moving the directories, update /etc/passwd either manually or with usermod (I think).
I have changed mine very recently (due to a reorganization/resize of partitions) and the only other thing I did was be careful to check and change all config files that had the path hardcoded.
When copying things with cp beware that cp -a doesn't copy really everything, if you have dot files in the working directory they will not be copied (make some tests before). To do it all at once use:
cp -a `ls -A | grep -v lost` destination
to find config files that may need changing I've used:
grep -irl old_home_path `ls -A | grep '^\.'` > files_to_change.txt
then inspected the file for possible binary file matches (firefox and thunderbird will have some files on the list).
Finally just did
cat files_to_change.txt | while read -r ff; do sed -i s/old_path/new_path/ $ff; done
As always __backup everything before you start__, I had a disk image of the whole hard disk, I could afford to screw things up. Make sure you have a safety net in case something goes wrong.
On the use of gparted, I didn't want to use it because it makes a mess out of the partition table and there are cases where it screwed things up quite badly (specially when moving/resizing partitions, I had a really bad encounter with this problem and other people too), I did a full disk image (I had a spare disk big enough for that) and started from scratch. As a plus you can change the filesystem of the partition easily and take advantage of all the features of recent filesystems (ext4 comes to mind ).
Edit:
Small code correction.
Last edited by R00KIE (2009-12-20 20:33:16)
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
I have done this sort of thing quite often. The most recent was on the weekend I converted my main workstation to lvm. I never use any partition resizing apps for this as they just make me too nervous. I always just back up everything to external storage using cp -av in a livecd environment, repartition, create file systems and then copy everything back. Fix /etc/fstab, grub and your initrd and you are good to go.
Offline
Thanks for the code. That was helpful
Offline
This is Alan Cox's backup script - I just love it for the ease and simplicity and it does dot-files and links perfectly ...
So here goes:
(cd $SRC && tar cf - .) | (cd $DEST && tar xvpf -)
Offline
This is Alan Cox's backup script - I just love it for the ease and simplicity and it does dot-files and links perfectly ...
So here goes:(cd $SRC && tar cf - .) | (cd $DEST && tar xvpf -)
wow this looks great! i really appreciate it, thanks!
Quis custodiet ipsos custodiet?
Offline
Pages: 1