🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: dc.org.linux-users
Article #3740

Re: How to repartitioning an existing HD having DOS and Linux

#3740
From: Przemek Klosowski
Date: Thu, 07 Sep 1995 00:00
72 lines
2980 bytes
Manjit asked

   1.  How can I get to increase my DOS partition size to be the entire 540MB of
   my original disk without losing any data or DOS config/setup?
   2.  How can I transfer my existing Linux partition(s) safely (w/o losing any
   data or config) to the new HD?

Warning: the following is untested. It should work, however; I did
similar things in the past. However, all mishaps belong to you, not
me; you should have backed up any important data anyway.

Basically, you want to copy both Linux and DOS files to your new disk,
repartition the old one, restore DOS to it and delete DOS files from
the new one.

In DOS make a dos bootable diskette (format/s) and copy format.exe and
fdisk.exe to it (command.com should be there from format/s). Now you
can boot linux, and use fdisk to make one big Linux partition on your
second drive:

	850 MB disk with one linux partition, hdb1

and run these commands

	cd /
	mkdir /rootcopy
	mke2fs /dev/hdb1
	mount -t ext2 /dev/hdb1 /rootcopy

now a ticklish moment: you want to copy everything from under root to
/rootcopy, but you have to exclude rootcopy (and possibly any other
NFS/SCSI/... filesystems that you may have). If 'ls -a /' shows files
'.xxx a b c d rootcopy x y z', do

	tar cf - .xxx a b c d x y z | (cd /rootcopy ; tar xf -)

OK, so now /rootcopy has a copy of your Linux filesystem; time for DOS.

	mkdir /dos /rootcopy/doscopy
	mount -tmsdos /dev/hda1 /dos
	cd /dos
	tar cf - * | (cd /rootcopy/doscopy; tar xf -)

Note that you have to use tar if you want to preserve links (only 
concerns Linux) and file dates (both Linux and DOS).

Now you need to reset lilo so that it can boot from the second disk too: 
add an appropriate section to /etc/lilo.conf. Reboot and check that
you can indeed boot Linux on the second drive

Now your second disk has both Linux and DOS; we can blow away the first one.
Boot DOS, fdisk first drive for one 540MB dos partition, and format/s it.
You will need the diskette that you made, as repartitioning wipes out
your format.exe on disk.

Boot Linux from the second drive and do:

	mount -tmsdos /dev/hda1 /dos
	cd /doscopy
	tar cf - * | (cd /dos; tar xf -)

Now, finally here's a command that rejoices the heart

	rm -rf /doscopy              

--
			przemek klosowski (przemek@nist.gov)
			Reactor Division (bldg. 235), E111
			National Institute of Standards and Technology
			Gaithersburg, MD 20899,      USA

			(301) 975 6249
Technical Details
Message-ID: <PRZEMEK.95Sep7173730@rrdjazz.nist.gov>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <MANJIT.95Sep6161938@kuki.tis.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11663c,fffa5315ef673570
X-Google-Attributes: gid11663c,public
From: przemek@rrdjazz.nist.gov (Przemek Klosowski)
Subject: Re: How to repartitioning an existing HD having DOS and Linux
Date: 1995/09/07
Message-ID: <PRZEMEK.95Sep7173730@rrdjazz.nist.gov>
X-Deja-AN: 109674453
distribution: usa
references: <MANJIT.95Sep6161938@kuki.tis.com>
organization: U. of Maryland/NIST
newsgroups: dc.org.linux-users