Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Jul 2005 18:12:10 +0100
From:      Alex Zbyslaw <xfb52@dial.pipex.com>
To:        Jerry McAllister <jerrymc@clunix.cl.msu.edu>,  gjbailey@gmail.com
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: Dump & Restore to smaller partition
Message-ID:  <42CABF6A.7010400@dial.pipex.com>
In-Reply-To: <200507051436.j65EaAnM021408@clunix.cl.msu.edu>
References:  <200507051436.j65EaAnM021408@clunix.cl.msu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Jerry McAllister wrote:

>>Hello,
>>
>>Does anyone know if the dump and restore method for
>>moving a partition to a new disk requires the destination
>>partition to be as big or bigger that the source?
>>    
>>
>
>It will need to be big enough to contain all the data.
>It the old file system had a lot of empty (unused) space then
>the new one can be smaller by about the amount of space
>that was unused..   
>
>  
>
>>>From my understanding, the whole partition, including
>>blank space will be dumped and restored. If this is the
>>case then the destination will need to be at least as big.
>>    
>>
>
>Only the files (directories are also files) get dumped.  It
>does not dump the filesystem as it was newfs-ed.  Rather it
>makes a list of all the files & directories by inode number and
>then dumps each along with all ownership, permission, flag and
>link information.
>
>  
>
>>My situation is as follows:
>>I have a 30GB usr partition with about 10GB of data in it.
>>I want to move this data (flags and all!) to a new 20GB
>>usr partition.
>>
>>Will dump/restore do this? .. or what should i use?
>>    
>>
>
>No problem.
>
>After making the new partition with disklabel and making a filesystem 
>out of it with newfs.   Presuming your old 30 GB filesystem is mounted
>as /fsa and the new 20 GB filesystem is mounted as /fsb, 
>
>    dump 0af /fsa/fsa.dump /fsa
>    cd /fsb
>    restore rf /fsa/fsa.dump
>
>should work just fine - although it makes me nervous to put the
>dump file in the same filesystem you are dumping.   Since it makes
>the inode list before it starts dumping and creating the dump file,
>it should work.  It just feels weird.    So, if you have some other
>place to put a 10 GB dump file, then go ahead and use it instead.
>  
>
Just do it with pipes:

dump -0af - /fsa | (cd /fsb; restore -rf -)

Obviously /fsb must be mounted when you do this.

If you feel paranoid and don't mind it taking longer

dump -0af - /fsa | (cd /fsb; restore -ivf -)

will do the restore in interactive mode, allowing you to quit if you make a mistake e.g. you see the cd failed.  It would also let you select only a subset of files to restore.

Specifying -b 64 to dump and restore might make it go quicker.  And if this is a mounted UFS2 partition then dump should also take -L so it makes a checkpoint.

--Alex






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42CABF6A.7010400>