View previous topic :: View next topic |
Author |
Message |
TheKingOfPain n00b
Joined: 13 Aug 2011 Posts: 14
|
Posted: Fri Apr 20, 2012 4:20 pm Post subject: Moving root to another filesystem |
|
|
I'd like to format my root partition to another filesystem(probably ext4, but everything else then btrfs should be fine). Is it possible to move the whole partition (for example using cp -R ) to another one, format root partition and move everything back?
Of course I mean if it is not only possible, but also if it is sensible. |
|
Back to top |
|
|
ShadowCat8 Apprentice
Joined: 07 Oct 2008 Posts: 173 Location: San Bernardino, CA, USA
|
Posted: Fri Apr 20, 2012 5:36 pm Post subject: |
|
|
Well,
Something to keep in mind as you put everything back: As parted loves you remind you - "Remember to update your fstab."
Overall, as long as you are doing the copy out and back from a LiveCD/LiveDVD environment, I don't see any major issues with it. And, to make sure that you cut down possible issues, I would recommend using
Code: | ~ # cp -a <source> <dest> |
That should maintain ownership, permissions, timestamps, symlinks, etc.
HTH. Let us know. _________________ ________________________
"As far as the laws of mathematics refer to reality, they are not
certain, and as far as they are certain, they do not refer to reality."
-- Albert Einstein |
|
Back to top |
|
|
denial n00b
Joined: 15 Nov 2007 Posts: 5
|
Posted: Fri Apr 20, 2012 6:47 pm Post subject: |
|
|
This should not be a problem at all, as long as you have a way of booting the system (Live CD, or from a USB stick) and another partition with enough space.
I would recommend tar rather than cp.
All the information you might need about that (and more) can be found here: http://en.gentoo-wiki.com/wiki/Custom_Stage4 |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Fri Apr 20, 2012 7:44 pm Post subject: |
|
|
i moved recently root with cp -a source destination
the only weird thing i had to move the destinatin form a folder one folder below thats it..
Boot with livecd, and cp -a thats it
there are other suggestions with DD and other stuff but i dont suggest to use dd.. |
|
Back to top |
|
|
aCOSwt Bodhisattva
Joined: 19 Oct 2007 Posts: 2537 Location: Hilbert space
|
Posted: Fri Apr 20, 2012 8:04 pm Post subject: |
|
|
I like rsync.
So I would backup root that way Code: | # rsync -vaHXx8 --del / whatever_backup_location_path |
Then... the other way around. _________________
|
|
Back to top |
|
|
denial n00b
Joined: 15 Nov 2007 Posts: 5
|
Posted: Fri Apr 20, 2012 8:24 pm Post subject: |
|
|
I guess I just like tar, but I agree that cp and rsync can do the job. Definitely not dd though as it works below the file-system level and would destroy any reformatting changes.
Whatever too you use, you should take care with /proc and /dev - you don't want to leave your system without /dev/null and /dev/console after restoring. |
|
Back to top |
|
|
BillWho Veteran
Joined: 03 Mar 2012 Posts: 1600 Location: US
|
Posted: Sat Apr 21, 2012 12:36 am Post subject: |
|
|
TheKingOfPain,
I think cp -a would be better than cp -R if you decide to go that route.
Also, don't forget grub entries rootfstype= real_root = or root=
Good luck _________________ Good luck
Since installing gentoo, my life has become one long emerge |
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2021
|
Posted: Sat Apr 21, 2012 8:38 am Post subject: |
|
|
KingOfPain, Do you have a separate /boot partition? If not, and it's part of your root file system, I think you should rerun grub-install after moving to the new format. Otherwise grub might barf when it tries to find its components that have moved. _________________ Greybeard |
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3925 Location: Hamburg
|
Posted: Sat Apr 21, 2012 8:55 am Post subject: |
|
|
denial wrote: | Whatever too you use, you should take care with /proc and /dev - you don't want to leave your system without /dev/null and /dev/console after restoring. | IMHO /dev/console isn't necessary, but /dev/zero should already been created. |
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3925 Location: Hamburg
|
Posted: Sat Apr 21, 2012 9:16 am Post subject: Re: Moving root to another filesystem |
|
|
TheKingOfPain wrote: | (but everything else then btrfs should be fine). | yes TheKingOfPain wrote: | (for example using cp -R ) | better "cp -ar", or you use something like Code: | cd /to/old/root/; tar -cpf- ./* | (cd /to/new/root; tar -xpf-) | while you booted from a LiveCD - at least in the (bad) old days "tar" was faster than "cp" in such a szenario |
|
Back to top |
|
|
ShadowCat8 Apprentice
Joined: 07 Oct 2008 Posts: 173 Location: San Bernardino, CA, USA
|
Posted: Mon Apr 23, 2012 9:07 pm Post subject: |
|
|
Greetings,
@toralf: Just as a note, the "cp -ar" is a bit redundant as '-a' covers '-r'. That being said, excellent call on the "tar stream copy" (as one of my linux mentors used to call it). Using that should also preserve everything and, in my experience, be even faster than "cp" in this case.
HTH. _________________ ________________________
"As far as the laws of mathematics refer to reality, they are not
certain, and as far as they are certain, they do not refer to reality."
-- Albert Einstein |
|
Back to top |
|
|
|