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

Re: Repartition

Mark Yobb dixit:
> A rough step by step would help me out a whole bunch.  Thanks

You might copy the whole filesystem (or by directories) to a different
location.  That depends on whether you have an empty partition where to do
this, or a tape drive like a zip drive.

A straight forward method would be by using the `cp' (copy) command or, if
you have not enough space available you could use `tar' (to archive and
compress).  In either case you should keep in mind the need to "preserve"
file and directories permissions as they are, as well as to copying symbolic
links as such, and not as files.  This can be achieved by passing the `a'
option to the copy command (`cp -a'), or the `preserve' option to the tar
command (`tar --preserve') (I haven't tried it with tar, but in theory,
`tar --preserve -zcvvf <filename>' should work).

You should have a thorough reading of the Hard-Disk-Upgrade mini-howto, as
Tom Pfeifer suggested.  Also, have a look at `man cp' and `man tar'.

Now, if you change the partition you will have to reflect this on your
/etc/fstab file.  For instance, if you currently have the entire Linux on
/dev/hda2, and decide to make several logical partitions out of it, so that
different partitions hold different directories, then you should change
/etc/fstab to something like this:

# /etc/fstab: static file system information.
# <file system>	<mount point>	<type>	<options>		<dump>	<pass>
/dev/hda2	/		ext2	defaults,errors=remount-ro   0      1
/dev/hda3               none            swap    sw          0       0
proc                /proc           proc    defaults    0       0
/dev/hda4 /usr ext2 defaults 0 2
/dev/hda5	/home	ext2	defaults	0	2
/dev/hda6	/usr/local	ext2	defaults	0	2
/dev/hda7	/var	ext2	defaults	0	2

For all the above you will need a boot disk with which to run fdisk,
repartition, and then replacing the filesystem.

A more secure way to do this would be to just copying those directories where
you have your personal data, such as /home, /root, /etc, (probably /var, and
/usr/local if you have installed programs there)... then resizing the
partition and reinstalling Debian.  After that, you'll just have to replace
the directories you want to preserve.  This way is more secure and less
painful, in my opinion.

Whichever method you choose (the ones mentioned, those in Hard-Disk-Upgrade
mini-howto, or else) plan it carefully before starting, as you risk loosing
data or worst if you make a silly mistake.

Finally, wait for some more insights on this message, since I do decline all
responsibility on any damages this may cause.

One problem I did find was that `cp -a' did not preserve /tmp and /var/tmp
permissions (drwxrwxrwt), and since some programs could not write to them
(eg. mutt), they would not properly work until I restored them to their
original permission by hand.

Good luck,


Reply to: