Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 06-19-2004, 12:03 AM   #1
Registered: Jan 2004
Location: Minnesota, USA
Distribution: Slackware 10, Debian Sarge
Posts: 91

Rep: Reputation: 15
Moving data to another hard disk.


I have a system with a 30gig hard disk partitioned into two partitions. I have /home mounted on one partition and I dump all of my files in my home directory. I just recently bought a 160gig hard disk and would like to remount /home on the new hard disk. Is this just a process of copying files into the new hard disk, and then mounting it as /home ... or do I have to follow any specific steps?
Old 06-19-2004, 12:31 AM   #2
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Not really - I've moved root-level directories with 'cp -a' with no adverse effects. There shouldn't be much in /home that's specific to the locations - most stuff should be '~' or '/home' rather than 'hd?N'. So all you should really have to do is copy them and edit fstab and you can even umount and re-mount without rebooting.

I've moved whole systems around and stuff like /var and /tmp but not /home, though, so there may be gotchas I'm unaware of.

Why not just mount a subdirectory on the new drive under /home and keep /home on its current disk?
Old 06-19-2004, 01:23 AM   #3
Registered: Jan 2004
Location: Minnesota, USA
Distribution: Slackware 10, Debian Sarge
Posts: 91

Original Poster
Rep: Reputation: 15
Thanks for your reply. I think you answered my question very well.

As for mounting a new partition under /home, the system has a lot of users and I would like them to be able to take advantage of the new hard disk space, so mouting /home on the new disk would probably be the best way.
Old 06-19-2004, 04:26 AM   #4
Registered: Mar 2004
Location: Georgia
Distribution: SlackWare 10.1+, FreeBSD 4.4-5.2, Amiga 1.3,2.1,3.1, Windors XP Pro (makes a fair answering machine)
Posts: 287

Rep: Reputation: 30
There is a step missing here!!!! It is listed in the HOWTOs for migrating across disk so I assume it is REQUIRED....

You should first install the disk on your box and then run fdisk/cfdisk to define the partition, type and write the MBR.
Next you should mke2fs the disk or use your file system type and format it.

Once this is complete THEN you mount it to a tmp location and copy your directories/files to it.
Suggested for the cp command is `cp -Rap` as this will copy the directories and file verbatium (xcopy style).
Since you plan to mount this as /home you should have all users logout and then you should logout to root (not su for a user). mv /home /home.old, mkdir /home
edit fstab
/dev/"harddrive" /home ext2 defaults 1 2
Then you can mount it. Remember to unmount it from it's tmp location!!!

Other notes on this;
you can do this with any part you wish to divide off of /. Using the steps above you can have mount points across various harddrives and partitions such as /usr, /usr/local, /var, /tmp, /spool, /usr/src, etc etc... Also root (/) is easy to migrate this way for making clone hardrive images (one note here, if lilo has been put in the MBR this will not work as you will only be coping the file system and not the MBR of the disk.)

My first test slack install was on a single drive which was then "broken" down across two drives w/4 parts.
Now on my "daily driver" box slack is divided across 3 harddrives, 9 partitions (2 bootables).
The Dragon on the other hand has 8 drives w/27 partitions (it is the frontend of the wulf and contains multi-bootable parts as well as the node roots.)

It pays to have an install across various disk as a failure of one can be easily "fixed" with new disk and backups without losin' the whole cookie...
Old 06-19-2004, 08:18 AM   #5
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 5,390

Rep: Reputation: 409Reputation: 409Reputation: 409Reputation: 409Reputation: 409
You can use tar to preserve permissions
cd /source_partition; tar cvf - . | (cd /destination_partition; tar xvf -)
Old 06-20-2004, 01:53 AM   #6
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Rep: Reputation: 34
Using 'cp -a' should work fine.......the '-a' flag is the same as using '-dpR', which is a recursive copy that keeps all permissions and preserves links (rather than follow links)...........

I use this a lot for moving stuff around, including the system files as well as the data files (such as for backups)........

PS: The only 'gotcha' is if you have any mount points in /home.......I have all my mount points in the /mnt directory, with symlinks in my home directory which point to them.........

Last edited by thegeekster; 06-20-2004 at 01:59 AM.
Old 06-20-2004, 07:10 AM   #7
Senior Member
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,289

Rep: Reputation: 52
I did once try to put /etc on it's own partition, don't try it!
Old 06-20-2004, 11:41 AM   #8
Senior Member
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577

Rep: Reputation: 48
Originally posted by Tuttle
I did once try to put /etc on it's own partition, don't try it!
I'll make a bet that ALL your symlinks got broken when you tried this!!
Old 06-20-2004, 11:49 AM   #9
Senior Member
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,289

Rep: Reputation: 52
lol, more the fact that / was mounted at boot, then the kernel looked in /etc/ and then put its finger in its mouth, tapped its foot and said "er" while staring at nothing.
the symlinks didn't even get the chance to say "what the...."!
Old 06-20-2004, 01:38 PM   #10
Registered: Jun 2004
Location: Beijing
Distribution: Slackware 9.1 but FUBAR with packages I compile myself, and OpenBSD (not exactly a distro) on QEMU
Posts: 153

Rep: Reputation: 35
I think you need to adjust your view about the new harddisk a bit... I assume you have partitioned it and put a new filesystem on it, ... right?

Then the disk is just a storage medium, on which you can put data. Simply install the disk (I mean, turn the computer off, slide the harddisk in, connect the cables, turn it on again, or maybe different steps for an external harddisk, which is not likely the case here...) and mount it. Then copy the data in /home to the mounted fs, and then unmount it.

Then edit your fstab to reflect the changes (the device name for the /home mount point), and mount your /home partition (this time it is on the new disk, not the old one).

See? The new disk is nothing but a storage medium.
Old 06-20-2004, 11:17 PM   #11
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
It is possible to have /etc on a different partition. I do it with my embedded distro.

You need to have a minimal /etc stored in an initrd, and then mount the /etc partition while INIT is running the startup scripts.

It confuses the hell out of /etc/mtab though, so you also have to modify the way the system mounts and unmounts volumes.


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
How to recover data from hard disk dongyan_liu Linux - Newbie 1 12-01-2005 05:56 PM
recovering data from hard disk planctus Linux - Hardware 4 10-10-2005 04:02 PM
moving hard drive with existing data to FC3 supra92 Linux - General 6 12-28-2004 03:09 PM
copying/moving stalls when moving a lot of data to a usb stick =X= Linux - Hardware 10 07-30-2004 05:29 AM
moving hard disk with fedora2 to another computer?? new22linux Fedora - Installation 1 06-05-2004 11:45 AM > Forums > Linux Forums > Linux - Distributions > Slackware

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

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