On Fri, Nov 13, 2009 at 03:28:04PM -0500, Roger wrote: > Hello all, > > I'm in control of a dedicated server and I would like to re-install FreeBSD. > I found the following guide: > http://www.freebsd.org/doc/en/articles/remote-install/ > which seems to cover pretty much all should need but it assumes that > I have some other OS (linux) installed, since I have FreeBSD 7.2-p4 I wonder > if maybe there is an easier way.
Well, you say a dedicated server, but you do not say it is remote. The article is for a remote install - that is, one where you cannot put your hands on the actual machine. The article also assumes you are making a raid with gmirror. With just one drive, you can ignore that stuff. If it is really a remote machine, then you will have to go through that stuff about building an mfs and running from it. But, not if you have direct access to the machine. If you can get to it and shut it down and put CDs in it, the process is much more simple. In that case you just do good backups and check them out to make sure they are readable, put the install CD in and boot the machine. That will bring up Sysinstall which will do everything for the main install. Then you will probably want to csup(1) both the base system and the ports tree and rebuild the base according to the handbook. Then install your ports. Finally restore your backups. Or, if you are completely happy with what is currently on the machine and you just want to reorder the partition sizes, then you don't even have to really do any install. Just do the backups, use the 'fixit' disk to run bsdlabel to make the partitions. Newfs(8) the new partitions. Then restore the backups over the top of things. > The reason for wanting to re-install is because I only have on big > slice that covers the > entire harddrive and I don't want that. Primarily I would like to have > /usr/local > in a separate slice. Really in a separate slice?? Or do you mean a separate partition. It is possible that you used only a slice and no partitions, but it is not the usual thing. That is kind of halfway to what they call a 'dangerously dedicated' disk in the handbook. Maybe you could call it a dangerously dedicates slice. It isn't really dangerous, but it limits some things you can do and for the disk, makes it so some types of things (that you most likely would never run in to) could not access it. So, Remember, in FreeBSD slices are the primary divisions (identified as 1..4) of the disk and partitions (identified as a..h) are subdivisions of slices. Presuming you are using SATA or IDE disk, the drive is ad0, or if you are using SCSI or SAS disk, the drive is da0. The first single slice is either ad0s1 (or da0s1 for SCSI) thus the 's' in 's1'. Then in s1 you can have partitions a..h except c is reserved, b is best used for swap and a needs to be root. If you have a single slice and no partition, then you would be mounting all of /dev/ad0s1 as /. If you have partitions, then you would be mounting /dev/ad0s1a as /. In any case, it is easy to modify. The only reason you might want a separate second slice on a machine that is only running one version of FreeBSD is if you have used up all the partitions available in slice 1. Do a df -k to see what slices and partitions are in use. If you have partitions use bsdlabel to look at the label in more detail. From root, do: bsdlabel ad0s1 (or da0s1 for SCSI or SAS) Think about how you want the disk divided before you get into the middle of it. If the new /usr/local partition would be too big to fit in the new /usr partition along with the regular /usr stuff, then you will have to split them up before doing the backups. In that case, use tar(1) to make a file that contains all of /usr/local, then rm(1) the contents of /usr/local, then do the backups and go from there - use the bsdlabel from the fixit to rebuild the partitions (and newfs each of them), restore everything over the top, mount that new /usr/local (make sure you still have a /usr/local mount point and that you fix up /etc/fstab for it) and untar that ball you make of /usr/local. If there is plenty of room for it to be in the new /usr temporarily, then just do the backups and then use bsdlabel from the fixit to rebuild the partitions, newfs them and restore them from backups. Then rename the current /usr/local to get it out of the way, remake the /usr/local mountpoint, mount it and then use tar to copy everything from the old /usr/local to the new one. Check it out and then rm the old /usr/local. Again, presuming you have direct access to the machine, Make your backups and put them somewhere away from what you are doing - on tape, or a big USB drive or another machine's disk, etc. I vote for a big cheap USB drive if your machine supports it. Once you have readable backup -- and that /usr/local split out in a separate tar file, if it would be too big, then put in the CD with the fixit. There is a menu item to select that boot. It used to be on CD-1, but you may need to check that in case they moved it. Just put in the CD and boot and see what you get. Select the option and if it gives you a prompt, then you are running from it. It won't hurt your disk at that stage. If you really just have a single slice and no partitions, then your mounts in fstab would be just: /dev/ad0s1 / If you do not have a partition, but are running directly from a slice, eg have an unlabeled slice, then do the following. dd if=/dev/zero of=/dev/da0s1 bs=512 count=1024 bsdlabel -w -B ad0s1 bsdlabel -e ad0s1 That will clean up a little, start an initial label on the slice and then put you in to an edit screen. It will look something like: # /dev/ad0s3: 8 partitions: # size offset fstype [fsize bsize bps/cpg] c: 89867610 0 unused 0 0 # "raw" part, don't edit Edit that file so you have partitions you want Do NOT modify the c: line then write and exit. In vi, that would, of course, be ESC:wq that will write the label to the slice on the disk. If you already have partitions - eg there was an ad0s1a mounted to / Then skip the dd and the first bsdlabel and just do: bsdlabel -e ad0s1 You will get the partition edit screen about the same as before but it will have the current partitions in it, something like: # /dev/ad0s3: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 786432 0 4.2BSD 2048 16384 49160 b: 2572288 786432 swap c: 89867610 0 unused 0 0 # "raw" part, don't edit d: 1048576 3358720 4.2BSD 2048 16384 8 e: 6291456 4407296 4.2BSD 2048 16384 28552 f: 6291456 10698752 4.2BSD 2048 16384 28552 g: 72877402 16990208 4.2BSD 2048 16384 28552 NOTE: All these sizes and offsets are given in blocks of 512 bytes. You will need to modify these to make room for your /usr/local Do NOT modify the c: line One advantage of the new bsdlabel is that it will calculate offsets and the final partition for you - just put a '*' in the field. Note: On the disk above these partitions are currently mounted as: a: / b: swap d: /tmp e: /usr f: /var g: /home So, to squeeze in a partition for /usr/local you might do this: I will make it 2 GB in partition g: and that makes /home go to h: # /dev/ad0s3: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 786432 0 4.2BSD 2048 16384 49160 b: 2572288 * swap c: 89867610 0 unused 0 0 # "raw" part, don't edit d: 1048576 * 4.2BSD 2048 16384 8 e: 6291456 * 4.2BSD 2048 16384 28552 f: 6291456 * 4.2BSD 2048 16384 28552 g: 4194304 * 4.2BSD 2048 16384 28552 h: * * 4.2BSD 2048 16384 28552 This way, bsdlabel will calculate the offsets correctly and put all available remaining space in the last (h:) partition. Now my mounts (in fstab) would need to be: a: / b: swap d: /tmp e: /usr f: /var g: /usr/local h: /home You can divide this up however you want. You could put just the swap (you really should have a good amount of swap) and your /usr/local separately and all the rest in partition a: if you want. Then you would only have partitions a:, b: and d: To mount as: a: / b: swap d: /usr/local eg, following rebuilding the partitions, including creating the new /usr/local partition and restoring the backups, do the following. cd /usr mv local oldlocal mkdir local mount /dev/ad0s1g /usr/local (I just pulled a partition 'g' out of the air. Use what you actually make it) cd /usr/oldlocal tar cvpf /usr/local/loc.tar cd /usr/local tar xvpf loc.tar Now, check it out and make sure files in the new /usr/local are good cd /usr rm -rf oldlocal cd /usr/local rm loc.tar Then you should be good to go. > > Any input, advice, tips etc would be very welcomed. > (trying to be prepared before attempting anything) The main thing is to do backups that are stored on media off the unit you are modifying. Use dump(8) and restore(8). ////jerry > > Thank you, > -r > _______________________________________________ > email@example.com mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org" _______________________________________________ firstname.lastname@example.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"