Re: repartitioning without losing data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the responses, guys.

Another quick question: I'm aware that what I'm going to propose is not the 'best' way to do this, but will it work?

I'd prefer to do this while not in single user mode. I understand that the main risks are that the home dir would be modified while I'm in the process of moving it.

However, this is a webserver, and there are only two other users besides myself. I can have them not change anything while I work on this.

Basically, I just don't want the server to be down while I do this, and I'd prefer not to feel a time crunch while partitioning the disk. Maybe this is stupid, but I thought I'd ask.

Essentially, if I use Jason's method of creating a new mount point instead of just a dir that I copy to, I could have the /home dir (the new one) available while I partition the old /home.

Again, I know that single user mode is the best option, but is my idea a really bad idea, or just not the optimal way to do it?

Thanks again,
Jon

At 22:22 1/1/2004, you wrote:
Easy.


1) Reboot to single-user mode. 2) umount /home (if already mounted) 3) mkdir /home 4) mkdir /mnt/home 5) mount -t<type> /dev/<old /home partition> /mnt/home 6) mv /mnt/home/* /home/ 7) umount /mnt/home 8) Use parted to repartition and format your partitions (man parted) 9) mount -t<type> /dev/<new /home partition> /mnt/home 10) mv /home /mnt/home/ 11) umount /mnt/home 12) rmdir /home 13) Edit /etc/fstab as necessary 14) Reboot


Sounds worse than it is. It's just a lot of little steps. I haven't
used parted much, so I'd suggest testing it on another drive first, just
so you get comfortable with it.



P.S. Sean/Rodolfo/Ed, if I've forgotten anything, please speak up. I need sleep. ;-)


Heh... I was heading for bed myself when I saw this. Specifically disregarded it when I saw your answer since I knew the bases would be properly covered (the post coming from you and all), but was forced to come back when I noticed the postscript. Anyway, no... you haven't missed anything, as usual. I would change the following due to personal preference:


6) I think "rsync -avP /mnt/home/* /home/" be neater. Ownership, permissions, creation and modification times will be more carefully kept intact. And overall, I just trust rsync more than mv, since that's what I use regularly to mirror 90GB of data from one place to another. And I get a nice display of what's going on so I don't see a blank screen and chew my nails off while I wonder if it's working or destroying my data. <grin> Just personal preference, really.

10) See #6.

Note, also, that the user can get confused when doing this and wonder where the data is coming from or going to, with all those "home" directories running around. It might be easier to follow if the files were moved in this order:


1. From old /home partition 2. To /homebackup 3. To new /home partition

This seems like a little less work, since then what you have is:


1. Reboot to single-user mode. 2. "rsync -avP /home /homebackup" 3. CHECK THE CONTENTS OF /HOMEBACKUP!!! 4. "umount /home" 5. Use parted to: 5a. Delete old /home. 5b. Resize /. 5c. Create new /home. 6. Edit /etc/fstab to point /home to the new partition. 7. "mount /home" 8. "rsync -avP /homebackup /home" 9. CHECK THE CONTENTS OF /HOME!!! 10. "rm -rf /homebackup" 11. Reboot.

Remarkably similar, and in fact I reread your sequence to make sure I hadn't forgotten anything in noting mine. This is just (to my one-track mind) slightly less prone to confusion for a newbie.

For the OP: rsync and mv are both very sensitive about trailing slashes. Using "/home" means the home directory itself, and in some cases also its contents. Using "/home/" with a trailing slash means the contents of /home, equivalent to /home/*. So to illustrate:

"rsync -av /home /homebackup" will copy over the home directory and its contents to the / directory under the name /homebackup. You end up with /home and /homebackup with identical contents. But if you add in one slash, as in "rsync -av /home /homebackup/" you'll end up with /homebackup/home/* (the home directory and its contents copied to inside the homebackup directory, not to it.)

G'night!



--
Rodolfo J. Paiz
rpaiz simpaticus com
http://www.simpaticus.com


--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux