You are not logged in.

#1 2008-11-12 23:36:14

Caspian
Member
Registered: 2007-05-22
Posts: 263

[SOLVED] Moving /home folder to a new partition

I would like to move my home folder to a new partition. What would be the easiest and least painful way to do this?

Last edited by Caspian (2008-11-14 15:24:13)

Offline

#2 2008-11-13 00:23:33

MoonSwan
Member
From: Great White North
Registered: 2008-01-23
Posts: 881

Re: [SOLVED] Moving /home folder to a new partition

I'd use midnight commander to do this and have it retain permissions/ownerships so you don't end up with issues later.

You could also use something akin go gParted and clone your home partition over to a larger partition.

Offline

#3 2008-11-13 00:40:05

shazeal
Member
From: New Zealand
Registered: 2007-06-05
Posts: 341

Re: [SOLVED] Moving /home folder to a new partition

mount /dev/sdxx /mnt/newhome
cp -a /home/* /mnt/newhome
umount /mnt/newhome
rm -rf /home/*
mount /dev/sdxx /home

Might wanna tar up home first of course smile

Forgot to add also need to put the new home partition in the fstab, something like this.

/dev/sdxx /home ext3 defaults,noatime 0 1

Last edited by shazeal (2008-11-13 00:44:01)

Offline

#4 2008-11-13 08:16:37

eerok
Member
From: Canada
Registered: 2005-03-20
Posts: 171

Re: [SOLVED] Moving /home folder to a new partition

shazeal wrote:

rm -rf /home/*

This would be a disaster for me and perhaps some other people.  Anyway, you don't need to delete anything until after you've checked that your copying went well.


noobus in perpetuus

Offline

#5 2008-11-13 08:34:41

Caspian
Member
Registered: 2007-05-22
Posts: 263

Re: [SOLVED] Moving /home folder to a new partition

Ok, as i presumed. Thanks guys.

Last edited by Caspian (2008-11-13 08:48:31)

Offline

#6 2008-11-13 08:49:50

fumbles
Member
Registered: 2006-12-22
Posts: 246

Re: [SOLVED] Moving /home folder to a new partition

tar cf - . | (cd /mnt/newhome/ ; tar xfp - )

Is the fastest way to copy from one filesystem to another.

Offline

#7 2008-11-13 09:22:55

RedShift
Member
From: Belgium
Registered: 2004-07-16
Posts: 230

Re: [SOLVED] Moving /home folder to a new partition

fumbles wrote:

tar cf - . | (cd /mnt/newhome/ ; tar xfp - )

Is the fastest way to copy from one filesystem to another.

I don't see how converting to tar and then extracting again on the fly can be faster then a regular copy... Waste of CPU cycles.


:?

Offline

#8 2008-11-13 09:31:49

Caspian
Member
Registered: 2007-05-22
Posts: 263

Re: [SOLVED] Moving /home folder to a new partition

Ok, that didn't go well hmm
I did the following steps:

mount /dev/sda6 /mnt/hd
cp -a /home/* /mnt/hd
umount /mnt/hd

... and added the following entry to fstab

/dev/sda6 /home reiserfs defaults,noatime 0 1

After the reboot, i got the message that my users home folder is "/home/user", but that location doesn't apper to exist. I've done this procedure several times before and never had this kind of problem. What should i do?

Last edited by Caspian (2008-11-13 10:03:30)

Offline

#9 2008-11-13 09:55:33

vacant
Member
From: downstairs
Registered: 2004-11-05
Posts: 816

Re: [SOLVED] Moving /home folder to a new partition

fstab entry doesn't say where you want /dev/sda6 mounted. you want " /home " before " reiserfs "

Last edited by vacant (2008-11-13 09:56:00)

Offline

#10 2008-11-13 10:02:28

Caspian
Member
Registered: 2007-05-22
Posts: 263

Re: [SOLVED] Moving /home folder to a new partition

Oh sorry, that was i typo. Of course that the entry in fstab was:

/dev/sda6 /home reiserfs defaults,noatime 0 1

Offline

#11 2008-11-13 10:24:06

shazeal
Member
From: New Zealand
Registered: 2007-06-05
Posts: 341

Re: [SOLVED] Moving /home folder to a new partition

Is it actually mounted, just do 'mount' with no parameters. Kinda hard to see what is going wrong if you dont supply some output smile

Offline

#12 2008-11-13 10:26:55

shazeal
Member
From: New Zealand
Registered: 2007-06-05
Posts: 341

Re: [SOLVED] Moving /home folder to a new partition

RedShift wrote:
fumbles wrote:

tar cf - . | (cd /mnt/newhome/ ; tar xfp - )

Is the fastest way to copy from one filesystem to another.

I don't see how converting to tar and then extracting again on the fly can be faster then a regular copy... Waste of CPU cycles.

Its faster for network copies, not for disk to disk. Handy command though smile

Offline

#13 2008-11-13 10:41:41

RedShift
Member
From: Belgium
Registered: 2004-07-16
Posts: 230

Re: [SOLVED] Moving /home folder to a new partition

shazeal wrote:
RedShift wrote:
fumbles wrote:

tar cf - . | (cd /mnt/newhome/ ; tar xfp - )

Is the fastest way to copy from one filesystem to another.

I don't see how converting to tar and then extracting again on the fly can be faster then a regular copy... Waste of CPU cycles.

Its faster for network copies, not for disk to disk. Handy command though smile

Tar itself doesn't do any compression, and even makes the transferred data larger by the TAR & file headers! And even if you apply compression, CPU usage will be through the roof. You'll have to measure that if that actually gives you a speed advantage.

Last edited by RedShift (2008-11-13 10:42:06)


:?

Offline

#14 2008-11-13 15:50:29

Caspian
Member
Registered: 2007-05-22
Posts: 263

Re: [SOLVED] Moving /home folder to a new partition

The partition is mounted. I've checked that the moment i got the error output. I'm truly confused yikes

Offline

#15 2008-11-13 19:13:46

grep
Member
From: Finland
Registered: 2008-10-25
Posts: 13

Re: [SOLVED] Moving /home folder to a new partition

Caspian wrote:

The partition is mounted. I've checked that the moment i got the error output. I'm truly confused yikes

Hard to say without seeing that error output?

/dev/sda6 /home reiserfs defaults,noatime 0 1

Doublecheck, you didn't mean

/dev/sda6 /home/caspian   reiserfs   defaults    0 1

Offline

#16 2008-11-13 19:23:31

grep
Member
From: Finland
Registered: 2008-10-25
Posts: 13

Re: [SOLVED] Moving /home folder to a new partition

fumbles wrote:

tar cf - . | (cd /mnt/newhome/ ; tar xfp - )

Is the fastest way to copy from one filesystem to another.

Don't mind the speed, mind the peace of mind and easier correct results smile

E.g. tar handles links properly, whereas with cp you have to be careful that it won't "copy through" the contents of the link. I would never move data of system partitions with all kind of special files with cp.

Last edited by grep (2008-11-13 19:29:19)

Offline

#17 2008-11-13 19:26:22

Caspian
Member
Registered: 2007-05-22
Posts: 263

Re: [SOLVED] Moving /home folder to a new partition

No i meant:

/dev/sda6 /home reiserfs defaults,noatime 0 1

And i wrote in the earlier post that during gdm login the error was that /home/caspian doesn't seem to be a valid location.

Offline

#18 2008-11-13 22:13:40

shazeal
Member
From: New Zealand
Registered: 2007-06-05
Posts: 341

Re: [SOLVED] Moving /home folder to a new partition

Less say so and more output please.

ls -la /home
mount
tail /var/log/errors.log
cat /etc/fstab

Tar itself doesn't do any compression, and even makes the transferred data larger by the TAR & file headers! And even if you apply compression, CPU usage will be through the roof. You'll have to measure that if that actually gives you a speed advantage.

Quick google will tell you all you need to know smile

Offline

#19 2008-11-14 15:22:44

Caspian
Member
Registered: 2007-05-22
Posts: 263

Re: [SOLVED] Moving /home folder to a new partition

No need for that, the problem is solved. The filesystem was messed up on that particular partition. Once i recreated ext3 on it everything worked just fine. Thanks for all your help everyone...

Offline

Board footer

Powered by FluxBB