[SOLVED] running out of disk space and needing to transplant /home directories
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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?
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
/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?
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.)
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
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...
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.