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

Re: Repartitioning



On Wed, Jul 31, 2002 at 09:04:20AM -0700, Craig Dickson wrote:
> Karl E. Jorgensen wrote:
> 
> > > 3.  Copy all files from root partition to second HD.
> > 
> > Beware of symbolic links...
> 
> Ah, good point. cp would actually change all symlinks (and hard links)
> into separate copies, wouldn't it. So perhaps archiving to tar files
> would be better. tar understands both symlinks and hard links, right?

In the past I've had problems with tar; restoring symlinks did not
always work. AFAIR it was something with symlinks that pointed to
symlinks that pointed to symlinks .... pointed to a proper file. It gave
me errors during the restore. I resorted to cpio in the end.

I guess that if you use something like this (the verbose way for
readability):
    # (cd /; tar --create \
            --to-stdout \
            --one-file-system \
            --preserve # may be redundant. rtfm :-} \
            --numeric-owner \
            --exclude /home \
            --exclude /var \
            /  ) | (
        cd /root-backup; tar --extract \
            --file - \
            --preserve \
            --same-owner )

and it completes without errors, then I think you'll be safe :-) [Sorry,
I haven't got the disk space to test with].

As long as you don't have any hard links between e.g. /home and /var (or
other weird crosslink stuff like that), you should be OK. Most sensible
people would use symlinks for that anyway. (Although I cannot see any
mention of hard links in the debian policy!?)

> > You may want to look into ext2resize, it claims to be able to resize a
> > filesystem (but you still have to resize the underlying partition
> > afterwards).
> 
> If you reduce an X MB filesystem to Y MB (X > Y obviously), and the
> existing files aren't all in the first Y MB, will it move them?

I believe it does. Authoritative docs in the package.

> > Another way to do this could be to 
> > - make a backup of /etc and /var 
> > - save the output from "dpkg --get-selections" 
> > - do a complete reinstall on the new root partition
> > - restore /etc (I'm not sure about /var...)
> > - make sure you install the same packages as you had before:
> >     dpkg --set-selections  < yourfile && apt-get dselect-upgrade
> 
> That sounds like a lot more work. Copying files from one HD to another,
> and back again, seems simpler, as long as symlinks and hard links are
> respected.

It probably is :-)  But there's always more than one way to do things.

> Will "find / -type l" and "find / -links +1" show me all the symlinks
> and all the files with hard links (other than the original directory
> entry), so that I could verify afterwards that everything was restored
> correctly, or fix by hand those that weren't?

Yep. If you're paranoid then you may even want to do md5sums or
byte-by-byte comparison of files. Don't forget to check ownership
(numeric owners, if you boot from a CD), permissions and (possibly)
modification times (some programs react on that, e.g. diald).

Note: The output from "ls" is not immediately usable here -
      directories will probably have different sizes, and so will
      last-accessed times.

HTH
-- 
          _  __
|/ _  _| |_   | _ __ _  _  _  _  _  _
|\(_|| | |_   |(/)| (_|(-'| |`-,(-`| |       http://www.karl.jorgensen.com
            \_|      _|

Attachment: pgpRjbJ0MAWJP.pgp
Description: PGP signature


Reply to: