LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-04-2009, 07:49 PM   #1
unclejed613
Member
 
Registered: Mar 2009
Posts: 352

Rep: Reputation: 32
running out of disk space and needing to transplant /home directories


so i need to do this as seamlessly and painlessly as possible. i have a mostly empty 1TB drive i can move them to, just wondering what the process would be without all kinds of file permission "gotchas". my thinking is to log in as root, copy /home to /home on the TB drive or a 32G partition there that now sits empty and as yet unmounted). how then do i A) do this without changing all of the file permissions to root, and B) let linux know where the new /home directory tree is?

Last edited by unclejed613; 11-04-2009 at 07:51 PM.
 
Old 11-04-2009, 08:18 PM   #2
~sHyLoCk~
Senior Member
 
Registered: Jul 2008
Location: /dev/null
Posts: 1,173
Blog Entries: 12

Rep: Reputation: 129Reputation: 129
Quote:
A) do this without changing all of the file permissions to root,
File permissions will retain as it was originally, I think.

Quote:
B) let linux know where the new /home directory tree is?
Modify /etc/fstab ?
 
Old 11-04-2009, 08:53 PM   #3
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora, Centos, Manjaro
Posts: 317

Rep: Reputation: 70
A couple of suggestions:-

1. Use logical volumes and add the new disk as part of your logical volume.
2. Use symbolic links to link /home on one partition to /home on the other partition.
3. If you have a separate partition for /home then it could be a quick edit of /etc/fstab
 
Old 11-04-2009, 09:45 PM   #4
unclejed613
Member
 
Registered: Mar 2009
Posts: 352

Original Poster
Rep: Reputation: 32
when i copy i won't have any files "refuse" to be copied (such as dotted directories, or files marked read only, etc...)?? maybe i'm just too used to attempting similar things with windows, and having a ton of broken links to clean up later, just to get things working again....


so when i add the entry in fstab, i'll have to delete the original /home directory at the same time, correct?
 
Old 11-04-2009, 10:28 PM   #5
tommylovell
Member
 
Registered: Nov 2005
Distribution: Raspbian, Debian, Ubuntu
Posts: 380

Rep: Reputation: 103Reputation: 103
It'd be easier to use rsync to copy the data.

You didn't say if you used LVM. That would make it easier to add disk, resize your logical volume, resize the filesystem on that LV.

You also didn't say if your existing /home directory is a separate filesystem mounted on /home, or simply a directory within the root filesystem. It matters

But, assuming you are not using LVM and your old /home directory is in a separate filesystem, you could mount your new partition; rsync the home directory to it; edit /etc/fstab to mount the new partition on the /home mount point; reboot (as it is nearly impossible to umount /home). If you are happy with the new /home directory, you can free up the space occupied by your old /home.

rsync would be something like this:
Code:
rsync -avH /home/ /newhome
I'm fairly certain that rsync will keep your links intact.

An alternative is to use tar like this (there are slight variations to this, too, if you google for them):
Code:
(tar clf - /home) | (cd /newhome && tar xvfp -)
As many others have said, make sure you have a good backup; and research how to come up in rescue mode or single user mode if you need to recover...

Last edited by tommylovell; 11-05-2009 at 07:27 AM. Reason: correct error in rsync
 
Old 11-05-2009, 12:00 AM   #6
unclejed613
Member
 
Registered: Mar 2009
Posts: 352

Original Poster
Rep: Reputation: 32
/home is on root partition, not using LVM. root partition is on hdc1. hda is my original slack10, mounted as /slack10, hdb is a windows disk, hdc2 is a windows disk, sda2 is slack12.0, mounted as /slack120. sda1 was going to be a 32G windows partition, but is sitting empty and unmounted, because i gave up installing windows on it, so that's where i want to move /home. if you're wondering why all of the old partitions, it's because i'm a bit of a packrat, and i have stuff on those partitions i want to keep. i'm running slack 12.2-current (as of 2 weeks before 13 came out).

so if i repartition the empty one as a linux partition, and mount it as /newhome, rsync it, then delete /home and rename /newhome as /home in fstab, then that should work?
 
Old 11-05-2009, 01:48 AM   #7
uppman
Member
 
Registered: Jul 2008
Location: Stockholm, Sweden
Distribution: Slackware 13.1 32-bit
Posts: 145

Rep: Reputation: 24
A) Mount sda1 somewhere and copy the contents in /home :
sudo mount /dev/sda1 /mnt/zip
sudo cp -a /home/* /mnt/zip
sudo umount /mnt/zip

B) Put in /etc/fstab :
/dev/sda1 /home auto defaults 0 0

Reboot or do a "sudo mount -a" to mount /dev/sda1 to /home.
 
Old 11-05-2009, 02:03 AM   #8
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
1/ Go to runlevel 1
Code:
telinit 1
2/ Mount the unused partition
Code:
mount /dev/sda1 /mnt/hd
3/ Rsync the data across
Code:
rsync -avPzHh /home/ /mnt/hd/
4/ Do a quick check that all is the same (back it up is the safest)
Code:
diff -rn /home/ /mnt/hd/
5/ Delete the stuff in /home
Code:
rm -rf /home/*
6/ Assuming it's ext3 (the double >> are important)
Code:
echo '/dev/sda1    /home    ext3   defaults    1    2' >> /etc/fstab && mount -a
7/ Return to your normal runlevel 3 or 4
Code:
telinit 4
 
Old 11-05-2009, 02:12 PM   #9
+Alan Hicks+
Member
 
Registered: Feb 2005
Distribution: Slackware
Posts: 72

Rep: Reputation: 55
rsync isn't needed for this. Just mount the external drive at say /mnt/hd and use "mv" to move /home to /mnt/hd/home. Then you can edit /etc/fstab so the external drive gets mounted a /home on boot-up. Anything else is un-necessary fluff, "mv" gets the job done and when run as root maintains permissions (assuming of course that the external drive is running a decent filesystem. If it's vfat or something, things will get screwed up.)
 
Old 11-05-2009, 06:59 PM   #10
unclejed613
Member
 
Registered: Mar 2009
Posts: 352

Original Poster
Rep: Reputation: 32
ok, what am i doing wrong? i opened a terminal as root, and tried both the cp -a and the rsync methods. i'm getting a lot of "operation not permitted (1)" messages...
Code:
loads.rdf" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/history.dat" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/key3.db" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/localstore.rdf" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/mimeTypes.rdf" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/panels.rdf" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/prefs.js" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/search.rdf" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/secmod.db" failed: Operation not permitted (1)
azariah/.mozilla/default/nep1oys4.slt/chrome/
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/chrome" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/chrome/chrome.rdf" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/chrome/userChrome-example.css" failed: Operation not permitted (1)
rsync: chown "/media/Easy Drive/migrate/azariah/.mozilla/default/nep1oys4.slt/chrome/userContent-example.css" failed: Operation not permitted (1)
azariah/.mozi
 
Old 11-05-2009, 07:22 PM   #11
unclejed613
Member
 
Registered: Mar 2009
Posts: 352

Original Poster
Rep: Reputation: 32
never mind.... figured it out.... i was making a backup copy on a usb drive in case i ran into trouble, and forgot that the usb drive is vfat. it works fine going to a linux file system...
 
Old 11-05-2009, 11:05 PM   #12
unclejed613
Member
 
Registered: Mar 2009
Posts: 352

Original Poster
Rep: Reputation: 32
tnx everybody who helped..... only one scary moment, but was able to fix it easily.

i used the rsync method, which was probably slower, but worked just fine
here's what the process was:
1) cfdisk /dev/sda to make sure i had the right partition type (i used ext3)
2) mkfs.ext3 /dev/sda1 (actually i forgot to do this and caused a bit of a hiccup)
3) cd /slack120 (this is the drive i put my backup copy on)
4) mkdir migrate
5) rsync -avPzHh /home/ /slack120/migrate (created the backup copy)
6) mount /dev/sda1 /mnt/hd
7) rsync -avPzHh /home/ /mnt/hd (because i skipped step 2, this churned happily along, but wasn't really doing anything)
8) rm -rf /home (now i'm digging myself a bit deeper )
9) added the line /dev/sda1 /home auto defaults 1 2 to fstab
10) mkdir /home
11) reboot


during reboot, i noticed a "no superblock on /dev/hda1, /home not mounted" error message, so i did the following:

did step 2 here...
then:
12) mount /dev/sda1 /mnt/hd
13) rsync -avPzHh /slack120/migrate /mnt/hd (yes, the slash after migrate is missing which caused the scary moment)
14) umount /mnt/hd
15) reboot

this time the machine mounted /home, but when i logged into a user account got a "can't read from ./" message.... a little scary, especially because linux went to a blank text screen with only a mouse cursor. after rebooting, logged in as root and looked at /home, which contained 1 directory called /migrate, which contained the correct file tree, so i cut and pasted with the gui file manager, and everything works now...

Last edited by unclejed613; 11-05-2009 at 11:12 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Archiving old files from /home/* directories to less expensive disk storage. Cerephim Linux - Server 6 11-06-2009 11:25 AM
How to increase the disk space of /home peddip Linux - Server 5 06-12-2009 01:59 AM
Low disk space xp home 2canoe General 35 12-01-2008 01:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration