RE: transfering amongst partitions
On 2 Mar 2001, David Bishop wrote:
> hda1 = NTFS 4Gigs
> hda2 = ext2 / 2Gigs
> hda5 = swap 128 Megs
> hda6 = ext2 /home 2 Gigs
> and I want to end up with:
> hda1 = ext2 / 4Gigs
> hda2 = ext2 /home 4Gigs
> hda3 = swap 128 megs
> So my idea was, blow away the ntfs partition, and transfer everything over
> there, then blow away the other partitions, create a new 4 gig partition and
> transfer /home back. My two problems were: what can I use to copy the data
> without screwing anything up (I guess cp -ap will work?) and how to tell lilo
> where the new kernel is without booting off of a floppy (which, I guess I
Backup all the important data (like /home) first.
For hda1: Use fdisk to change type (but not size). Then use mkfs (or
mkfs.ext2). "cp -a" should work.
To do the rest, it would be a good idea to boot from a emergency/rescue
floppy, so you don't have to worry about swap and losing your commands
when you fdisk the currently used /.
You will need to know how to use your rescue disk. For example, to edit
lilo, you'll need to mount the partition, edit it, and then run lilo with
chroot. (I like TOMSRTBT as a Linux rescue disk.)
Use fdisk to remove your 2,5,6 (primary and logical) partitions and create
your new 2 and 3 partitions.
Use mkfs (mkfs.ext2) for hda2.
Configure lilo. Maybe your /etc/lilo.conf has "root=/dev/hda2"; change it
to hda1 and run lilo (chrooted if using rescue disk).
Set up new swap with mkswap.
cp the /home to the new partition. (In the past, I have had two
homes: /home and /home2 with identical content. I don't remove the
unneeded home until I have verified after a reboot.)
> > to use tar in the past, but had permision issues (things ended up being
> > owned by root).
tar should also work. Do some tests and practice with it.
> > tar, and how does copying device files work? I thought I read that would
tar and cp can properly copy device files; do some tests and practice.
# cp -a /dev/zero tmp/zero
# ls -l /dev/zero tmp/zero
crw-rw-rw- 1 root root 1, 5 Jan 30 13:41 /dev/zero
crw-rw-rw- 1 root root 1, 5 Jan 30 13:41 tmp/zero
Hopefully these ideas help; I may have missed something though.
Jeremy C. Reed
ISP-FAQ.com -- find answers to your questions