[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to copy partition?



kriol@interact.phtd.tpu.edu.ru wrote:
  >
  >Hi, All
  >
  >i had 330M old segate disk as my /.
  >
  >Now i'm getting 2Gig disk, but the question is -
  >how to copy the system from
  >old seagate to the new disk
  >(or to the new disk partition). I don't want
  >to reinstall/reconfigure everything...
  >
  >Is there Debian way/package for such things?

If you can have both disks installed, make the partition on the new
disk (`fdisk /dev/hdc' or whatever); make the filesystem (mkfs)

Then mount the new disk:

   # mount /dev/hdc1 /mnt  [make appropriate substitutions for hdc1]

then copy the root file system (excluding /mnt)

   # mount /dev/hdc1 /mnt
   # find / -xdev | cpio -pdm /mnt

If you are using lilo, you should probably run /sbin/lilo and tell it to
write a boot sector on the new disk.

Now you can shutdown and replace the old disk with the new one, and it ought
to work.


An alternative:

With so large a disk, you may want to make separate partitions for
root, /var, /usr and /home, or some combination; this means that a disaster
to one partition won't affect the others.

Suppose that you want to fill a new /usr partition which is on /dev/hdc1:
mount the new partition on /mnt:

   # mount /dev/hdc1 /mnt
   # cd /
   # cp -a usr /mnt
[cp -a is an alternative to the find|cpio I used above; find|cpio should work
on any Unix, whereas cp -a may not.]
   # umount /mnt
 
Do the same for the other partitions; the trickiest is root itself, since you
must exclude the directories that go to other partitions. I think that `cp -a'
and `find / -xdev' do that, but it needs checking.  (If you are going
to keep the old disk in your machine, there's no need to move root - just
delete the contents of the directories that you have copied and mount the
new partitions on them. That will leave root on the old disk, with more
space, and everything else on the new one.)

Edit <new-root_partition>/etc/fstab to list the partitions and say which
ones are to be mounted automatically; shutdown and reboot.
-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "I love them that love me; and those that seek me early
      shall find me."           Proverbs 8:17



--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: