Solved

Moving drives?

Posted on 1998-05-28
5
200 Views
Last Modified: 2010-04-20
I am currently running a slakware version of linux (I can't remember the version, but it's not too outdated) on the uncompressed partition of a dos-formatted drive compressed with Drivespace 3 (I'm using exclusively umsdos partitions).  That device is hda1.  I bought a new harddrive which is partitioned into several parts, the part I am interested in is hdb6.  I can mount that drive and use it without any problems.  Now I would like to (if possible) move my entire linux system over to the hdb6 device (1 gig is better than 150MB).  I startup linux using a boot disk so that will probably need to be changed also.  If I can't make a complete move, then I would like to move just the directories that will grown the most (I take that to be /usr and /home.  
0
Comment
Question by:BoB
5 Comments
 

Expert Comment

by:adt
ID: 1637255
Moving your Linux installation should work ok.

You should format the new partition with mke2fs and mount under something like /new
under linux.  Then you should 'cp -a' all of files a and directories in the root, except /new
to /new.

             SO:  cp -a usr new
                     cp -a vmlinuz new
                     ....

You'll then  want to cd /new and 'rdev -R vmlinuz 1' and 'rdev vmlinuz /dev/hdb6'.

You'll also then want to change /new/etc/fstab to reflect any new mount points and
filesystem types.

                    most notably, your entry for / should be something like
                    /dev/hdb6   /                          ext2   defaults  0  1


You can still boot with a boot disk, if you like.
               
                    you need to take a new disk (not your original linux boot disk) and:
                    'dd if=/new/vmlinuz of=/dev/fd0'
                    'rdev -R /dev/fd0 1'
                    'rdev /dev/fd0 /dev/hdb6'

I you'd like to use lilo instead, I'll submit a working lilo.conf later.

0
 

Author Comment

by:BoB
ID: 1637256
There is no vmlinuz file anywhere in my linux partition.  (that's the kernal right?)  I think my kernel is located in the linux/src directory (vmlinux is the filename) so is that what I am actually looking for for the rdev command?
0
 
LVL 1

Expert Comment

by:pablocosta
ID: 1637257
the kernel can have lots of different names
vmlinuz
zImage
.

I think I remember slakware calling it zImage when I compiled it.
You can guess the name of the kernel by looking at /etc/lilo.conf if you use lilo and the batch file you use to start linux if you are using loadlin. There you will find both the name of the image and the path to it.
0
 
LVL 1

Expert Comment

by:pablocosta
ID: 1637258
If you want to move only a few directories, you could try the following:

copy the entire directory from one partition to another
(you can do it file by file or by using tar)
Look for every link on the complete original partition pointing to the directoy you are moving!!!

this can be done with find, file and grep commands

rename the original directory to something different (add an underscore or so...) and then make a link to the new directory with the original name.

take care when moving important directories (i.e. /bin, /usr/bin)
because when you change the name of them you should then write the complete pathname for example when calling 'ln' to make the link. Just take a look at the location of these commands.

hope this helps
pablo
pablocosta@iname.com
0
 
LVL 3

Accepted Solution

by:
marcelofr earned 100 total points
ID: 1637259
You don't have/find your boot image because you boot from diskette!!! So you have a kernel image or a full bootable filesystem. In the later case, you should mount /dev/fd0 and search the kernel there, if the mount fails, probably you have only a kernel image in that disk.

First MAKE A COPY of the boot disk. Then MAKE SURE IT'S A WORKING COPY. You're warned!!!

Then take one of them and

rdev /dev/fd0 /dev/hdb6
or
rdev whatever_the_name_of_the_kernel_you_found /dev/hdb6

This is to make it boot from /dev/hdb6

I think you will make a swap partition (you don't mention it in your current configuration), so tell it:

rdev -s same_image_as_above /dev/hdb_your_swap_partition

On the other hand make an ext2 filesystem (mke2fs) on hdb6 and mkswap your swap partition. Now for the actual copy:

mount /dev/hdb6 /mnt/somewhere
cd /
find / -xdev -print | cpio -vdump /mnt/somewhere

now you [may] have TWO working copies of Linux... If everything went ok, try booting with BOTH boot diskettes... "df" will tell you what you got...

Hope your booting kernel is able to mount ext2 partitions...

Good Luck,

-- Marcelo
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now