Moving drives?

Posted on 1998-05-28
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.  
Question by:BoB

Expert Comment

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.


Author Comment

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?

Expert Comment

ID: 1637257
the kernel can have lots of different names

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.

Expert Comment

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

Accepted Solution

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
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

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
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.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

808 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