Date: Fri, 15 Nov 2002 10:58:14 -0500 (EST) From: Jerry McAllister <jerrymc@clunix.cl.msu.edu> To: hymette@wanadoo.fr Cc: freebsd-questions@FreeBSD.ORG (freebsd-questions) Subject: Re: How to backup a disk ? Message-ID: <200211151558.gAFFwE325204@clunix.cl.msu.edu> In-Reply-To: <3DD4AE2A.7000704@wanadoo.fr> from "hymette@wanadoo.fr" at Nov 15, 2002 09:19:54 AM
next in thread | previous in thread | raw e-mail | index | archive | help
> > hi, > I have a 6G disk and a 40G disk on which FreeBSD is installed. My system > does not fill 6G yet and I'd like to copy it to the smaller disk before > it grows. But I would like to have the copy bootable with preserved > privileges UIDs and GIDs, only the fstab changed. Which tools could I > use to get this backup? First, I am presuming there is nothing you want to save on the small disk (or you have already preserved it somewhere). While booted to FreeBSD Used fdisk(8) to create one large FreeBSD slice on the small disk. fdisk -IB da1 (or ad1 or whatever device the disk is) will slice the disk and put a standard boot sector on it. Then use disklabel(8) to initialize the slice and add boot blocks disklabel -w -r -B da1s1 (or ad1s1 or whaever) Then use disklabel to edit the partition table on the slice Look at what you already have to figure out appropriate sizes. disklabel -e -r da1s1 (ad1s1 or watever) add the partitions as needed. Note the size is in 512 byte blocks Put '*' in for offset for all but partition a: and c: so disklabel will calculate offset for you. For a: and c: put in '0'. Take the defaults for fsize (1024) bsize (8192) and bps/cg unless you really want to play with that. Omit the comments at the end of the line after #. Partition c: is the whole slice and is type 'unused' partition b: will probably be swap and is type 'swap' The remaining partitions will be files systems and type '4.2BSD' Finally, run newfs on the newly created partitions, something like: newfs -b 8192 -f 1024 /dev/rda1s1a (or Rad1s1a or whatever) "" "" "" "" "" e etc Don't newfs the swap partition or the c: partition Make mount points for the new partitions cd / mkdir newpa mkdir newpe etc Edit fstab to add entries for the new partitions and mount them /dev/da1s1a /newpa ufs rw 2 2 /dev/da1s1e /newpe ufs rw 2 2 etc mount -a or just manually mount them mount /dev/da1s1a /newpa mount /dev/da1s1e /newpe etc Now you can dump restore cd /newpa dump 0af - / | restore rf - cd /newpe dump 0af - /prev_e_mount_pt | restore rf - etc Now, shutdown your system, swap the drives and reboot. If you made the partitions identical (in name eg a,b,e,f,etc, not size) and edited /etc/fstab before dumping root then it should all come up with running on the new smaller disk and with the old large disk mounted on the /newpa, /newpe, etc mount points. Note that everything but the dump /restore can be done ahead of time. If you are really worried about losing some thing, you will want to do the dump/restore part in single user mode. So, after getting all the partitions made and editing /etc/fstab. Shutdown/reboot, come up in single user mode. Then do fsck -p mount -u / mount -a or maybe mount -a -t ufs,nonfs if you have nfs mounts in fstab swapon -a Then do the dump/restore operations as indicated above. Then, shut down, sap drives and reboot. ////jerry > > Thank you in advance. > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211151558.gAFFwE325204>