LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-21-2007, 07:05 AM   #1
ceashton
Member
 
Registered: Nov 2006
Distribution: Slackware 12.2
Posts: 36

Rep: Reputation: 15
Moving "/" to a new disk


Hi,

I am trying to move my root partition to a hard disk with more space, but before I go and fluff things up, I wanted make sure I have the correct approach.

Currently swap, /, /usr/local and /home are all mounted on their own partitions, but / is now rather full and needs moving to a separate disk. I've installed a new disk and formatted as ext3 using fdisk and mkfs.ext3. This new disk I have mounted under /new-disk to enable the copying of / to the new disk. Up to this point I have been following the instructions given in this Howto (http://www.tldp.org/HOWTO/Hard-Disk-Upgrade/).

Is there a reason not to use a rsync -a --exclude=some-dir-to-exclude / /new-drive command, rather than cp -a /bin /boot /other-dirs / /new-drive command?

I have come to understand that I don't want to copy /proc as this is a virtual file system containing system data, which is populated at boot time. I also don't want to copy /usr/local and /home, all of which I can specify with the --exclude= switch. Are there any other directories I shouldn't be copying? I am using Slackware 12.0 and the some of the dir aren't mentioned in the howto I am following, which I believe is quite old - but otherwise excellent to follow and explains the reasoning behind each stage. / currently contains the following dirs:

Code:
chris@dinosaur:~ $ ls -l /
total 92
drwxr-xr-x   2 root root   4096 2007-04-30 05:35 bin
drwxr-xr-x   2 root root   4096 2007-08-06 23:56 boot
drwxr-xr-x  21 root root  14120 2007-11-21 11:20 dev
drwxr-xr-x  63 root root   4096 2007-11-21 11:19 etc
drwxr-xr-x   5 root root   4096 2007-11-13 00:12 home
drwxr-xr-x   5 root root   4096 2007-07-31 19:31 lib
drwx------   2 root root  16384 2007-07-30 23:04 lost+found
drwxr-xr-x  16 root root   4096 2007-11-21 11:20 media
drwxr-xr-x  11 root root   4096 2006-09-26 04:09 mnt
drwxr-xr-x   2 root root   4096 2007-11-21 11:03 new-disk
drwxr-xr-x   3 root root   4096 2007-08-08 16:06 opt
drwxr-xr-x   2 1016 users  4096 2007-07-16 06:32 pmount
dr-xr-xr-x 101 root root      0 2007-11-21 10:38 proc
drwxr-xr-x  22 root root   4096 2007-11-17 20:34 root
drwxr-xr-x   2 root root   4096 2007-07-19 18:36 sbin
drwxr-xr-x   2 root root   4096 2007-07-30 23:13 srv
drwxr-xr-x  12 root root      0 2007-11-21 10:38 sys
drwxrwxrwt  10 root root  16384 2007-11-21 10:56 tmp
drwxr-xr-x  17 root root   4096 2005-07-29 10:44 usr
drwxr-xr-x  16 root root   4096 2007-07-26 20:15 var
So directories I believe I definitely want to copy over are:
Code:
/bin  
/boot  
/dev  
/etc  
/lib  
/lost+found  
/media  
/mnt  
/opt  
/root
/sbin  
/tmp  
/usr  
/var
Directories I definitely wouldn't are:
Code:
/home
/new-disk
/proc
Directories I am unsure about are:
Code:
/pmount
/srv  
/sys
Is this the correct method and has anybody got any suggestions on the directories I am unsure about? I've had a quick read of http://www.pathname.com/fhs/pub/fhs-2.3.html, and I'm guessing /srv should be copied.

Anyway, any help/suggestions would be gratefully received.

Chris
 
Old 11-21-2007, 07:20 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
When I have done similar movement of parts of my system between partitions, I did it via liveCD. Boot the live cd, mount only the root partition and copy it to the new partition. That way, /home is not copied (only the folder is copied, not the contents); same applies to /proc, /usr/local, /sys and any others that are only populated on bootup, or that reside in another partition.

Before reboot, remember to edit /boot/grub/menu.lst and /etc/fstab to show the new partition for /.

Last edited by bigrigdriver; 11-21-2007 at 07:21 AM.
 
Old 11-21-2007, 07:26 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
I don't think you need to copy /sys. Copying /tmp would be pointless. Also, lost & found is created during formatting. Don't copy it either. The /mnt and /media directories are used to mount other filesystems or devices. You do want to create /sys, /mnt, /media and /tmp on the destination however. For /tmp, change the permissions giving everyone full permissions and setting the sticky bit.
sudo chmod a=rwxt /new-drive/tmp

Even though you don't want to copy the contents of /home and /usr/local, you need to create these directories so that you have a place to mount these partitions on.

Last edited by jschiwal; 11-21-2007 at 07:29 AM.
 
Old 11-21-2007, 08:38 AM   #4
ceashton
Member
 
Registered: Nov 2006
Distribution: Slackware 12.2
Posts: 36

Original Poster
Rep: Reputation: 15
Thanks for the quick replies. I'm just trying it now, I'll report back my success!

Kind regards,

Chris
 
Old 11-21-2007, 12:37 PM   #5
ceashton
Member
 
Registered: Nov 2006
Distribution: Slackware 12.2
Posts: 36

Original Poster
Rep: Reputation: 15
Thanks for the help. The actual command I used to copy, was:

Code:
rsync -av --exclude=/home/* --exclude=/lost+found/* --exclude=/mnt/spare/* --exclude=/new-disk --exclude=/proc/* --exclude=/sys/* --exclude=/usr/local/* / /new-disk/ 1>/rsync.log 2>/rsync.log.error &
which seems to have worked fine, once I'd correctly configured fstab and lilo as per the Howto in my initial post.

Once again, thanks for the replies I received - you were spot on!

Chris
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 09:31 AM
Tip for non-Power Users: Moving from "less" directly into an editor rickh Linux - General 1 10-11-2006 11:16 AM
Allocating free disk space - start of "/ " needs moving. ibex Linux - General 4 04-17-2006 10:46 PM
"cannot change file permissions" error when moving data to and from pendrive Whiskers Mandriva 4 01-02-2005 03:49 AM
"YOU" says "could not write server list to disk" dushkinup Linux - Distributions 4 07-26-2004 01:01 PM


All times are GMT -5. The time now is 08:45 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration