Re: Resizing Partitions, Losing Windows XP...

2006-09-22 Thread John Nielsen
On Friday 22 September 2006 14:23, Jeff Cross wrote:
 I have been dual booting FreeBSD and Windows XP for quite sometime.
 However, I never boot into Windows XP any longer.  I can pretty much do
 everything I need to do from within FreeBSD.  Is there a way that I can
 wipe out the Windows XP partition, resize the FreeBSD partition, and
 install a standard FreeBSD MBR (no boot manager) without slicking and
 reloading the hard drive?

Probably several. See below.

 I really like the way I have my stuff setup within FreeBSD and would
 hate to have to recreate a lot of it as well as install applications
 over again.  Could I do a dump of my current FreeBSD partition, reformat
 and partition the whole drive, install FreeBSD, and then restore my data
 to the new partition or would this cause issues?

Yes you could, and this is probably the recommended approach. Make sure you 
get a dump of each FreeBSD partition if you have more than one ( /, /usr, 
etc). You'll need to know how to use fdisk, bsdlabel, and newfs in order to 
create your new partitions from a FreeBSD install CD's rescue prompt. If you 
pass a -B flag to both fdisk and bsdlabel you should be fine as far as the 
MBR and boot blocks are concerned. Of course you'll also need to be able to 
access your dumps on whatever media or network location you put them on, and 
know how to use restore.

Depending on how your disk is currently laid out, it might be possible to wipe 
out your windows partition and use growfs, but you really should have good 
backups before attempting this, so get a dump of everything in any case.

JN
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Resizing Partitions, Losing Windows XP...

2006-09-22 Thread Jerry McAllister
On Fri, Sep 22, 2006 at 01:23:28PM -0500, Jeff Cross wrote:

 I have been dual booting FreeBSD and Windows XP for quite sometime.
 However, I never boot into Windows XP any longer.  I can pretty much do
 everything I need to do from within FreeBSD.  Is there a way that I can
 wipe out the Windows XP partition, resize the FreeBSD partition, and
 install a standard FreeBSD MBR (no boot manager) without slicking and
 reloading the hard drive?
 
 I really like the way I have my stuff setup within FreeBSD and would
 hate to have to recreate a lot of it as well as install applications
 over again.  Could I do a dump of my current FreeBSD partition, reformat
 and partition the whole drive, install FreeBSD, and then restore my data
 to the new partition or would this cause issues?

That would be one good way of doing it.Just make sure and check
your dumps before wiping everything. (create a scratch space.  Cd to it
and read a few things back from the dumps and check them.   

You don't need to reformat the drive - that is too low level for this.
Just fdisk it and put all the disk in one slice - slice 1.  Make that 
slice marked bootable.Then use bsdlabel (disklabel pre 5.xxx) to 
divide up the slice in to partitions.   They will need to be the
same partition identifiers (a-h) as used currently.  Finally, 
use newfs to build filesystems on the partitions (except for swap)
and then restore the dumps to their original partitions.
Make sure you mount the partition as something and then cd in to
that appropriate partition to do the restore.

You will need to do the wiping and rebuilding from some other
media such as a fixit CD or another bootable disk.   You can't
wipe the slice that you are running from.


An alternative would be to leave the existing slice alone, but
use fdisk to mark the MS slice as a FreeBSD slice (not bootable)
and then either create one single partition in that slice or 
divide it as you choose and use newfs to create file systems.
Then, create a mount point for each new partition you made (put
them in /etc/fstab and mount them up.  Then move some of your big
directories in the existing FreeBSD slice over then and made 
symlinks to them.That way you would free up room in the FreeBSD
bootable slice, but not have to dump/restore and rebuild everything.
It is quicker and works just as well, but slightly less clean, though
it could be helpful if your file systems are too large for your
backup media.

jerry

 
 Any assistance is greatly appreciated!
 
 Jeff Cross
 http://www.averageadmins.com/
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Resizing Partitions, Losing Windows XP...

2006-09-22 Thread Jeff Cross
Jerry McAllister wrote:
 On Fri, Sep 22, 2006 at 01:23:28PM -0500, Jeff Cross wrote:
 
 I have been dual booting FreeBSD and Windows XP for quite sometime.
 However, I never boot into Windows XP any longer.  I can pretty much do
 everything I need to do from within FreeBSD.  Is there a way that I can
 wipe out the Windows XP partition, resize the FreeBSD partition, and
 install a standard FreeBSD MBR (no boot manager) without slicking and
 reloading the hard drive?

 I really like the way I have my stuff setup within FreeBSD and would
 hate to have to recreate a lot of it as well as install applications
 over again.  Could I do a dump of my current FreeBSD partition, reformat
 and partition the whole drive, install FreeBSD, and then restore my data
 to the new partition or would this cause issues?
 
 That would be one good way of doing it.Just make sure and check
 your dumps before wiping everything. (create a scratch space.  Cd to it
 and read a few things back from the dumps and check them.   
 
 You don't need to reformat the drive - that is too low level for this.
 Just fdisk it and put all the disk in one slice - slice 1.  Make that 
 slice marked bootable.Then use bsdlabel (disklabel pre 5.xxx) to 
 divide up the slice in to partitions.   They will need to be the
 same partition identifiers (a-h) as used currently.  Finally, 
 use newfs to build filesystems on the partitions (except for swap)
 and then restore the dumps to their original partitions.
 Make sure you mount the partition as something and then cd in to
 that appropriate partition to do the restore.
 
 You will need to do the wiping and rebuilding from some other
 media such as a fixit CD or another bootable disk.   You can't
 wipe the slice that you are running from.
 
 
 An alternative would be to leave the existing slice alone, but
 use fdisk to mark the MS slice as a FreeBSD slice (not bootable)
 and then either create one single partition in that slice or 
 divide it as you choose and use newfs to create file systems.
 Then, create a mount point for each new partition you made (put
 them in /etc/fstab and mount them up.  Then move some of your big
 directories in the existing FreeBSD slice over then and made 
 symlinks to them.That way you would free up room in the FreeBSD
 bootable slice, but not have to dump/restore and rebuild everything.
 It is quicker and works just as well, but slightly less clean, though
 it could be helpful if your file systems are too large for your
 backup media.
 
 jerry
 
 Any assistance is greatly appreciated!

 Jeff Cross
 http://www.averageadmins.com/
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 
 
 
This sounds scary, I mean ok, but will doing what you have mentioned in
this post do anything for the MBR?  Is that why I would be setting the
bootable flag in fdisk?  I am currently using NTLOADER to boot Windows
XP and FreeBSD 6.1-SECURITY.

Jeff Cross
http://www.averageadmins.com/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Resizing Partitions, Losing Windows XP...

2006-09-22 Thread Jerry McAllister
On Fri, Sep 22, 2006 at 02:50:31PM -0500, Jeff Cross wrote:

 Jerry McAllister wrote:
  On Fri, Sep 22, 2006 at 01:23:28PM -0500, Jeff Cross wrote:
  
  I really like the way I have my stuff setup within FreeBSD and would
  hate to have to recreate a lot of it as well as install applications
  over again.  Could I do a dump of my current FreeBSD partition, reformat
  and partition the whole drive, install FreeBSD, and then restore my data
  to the new partition or would this cause issues?
  
  That would be one good way of doing it.Just make sure and check
  your dumps before wiping everything. (create a scratch space.  Cd to it
  and read a few things back from the dumps and check them.   
  
  You don't need to reformat the drive - that is too low level for this.
  Just fdisk it and put all the disk in one slice - slice 1.  Make that 
  slice marked bootable.Then use bsdlabel (disklabel pre 5.xxx) to 
  divide up the slice in to partitions.   They will need to be the
  same partition identifiers (a-h) as used currently.  Finally, 
  use newfs to build filesystems on the partitions (except for swap)
  and then restore the dumps to their original partitions.
  Make sure you mount the partition as something and then cd in to
  that appropriate partition to do the restore.
  
  You will need to do the wiping and rebuilding from some other
  media such as a fixit CD or another bootable disk.   You can't
  wipe the slice that you are running from.
  
  
  An alternative would be to leave the existing slice alone, but
  use fdisk to mark the MS slice as a FreeBSD slice (not bootable)
  and then either create one single partition in that slice or 
  divide it as you choose and use newfs to create file systems.
  Then, create a mount point for each new partition you made (put
  them in /etc/fstab and mount them up.  Then move some of your big
  directories in the existing FreeBSD slice over then and made 
  symlinks to them.That way you would free up room in the FreeBSD
  bootable slice, but not have to dump/restore and rebuild everything.
  It is quicker and works just as well, but slightly less clean, though
  it could be helpful if your file systems are too large for your
  backup media.
  
  jerry
  
  Any assistance is greatly appreciated!
 
  Jeff Cross
  http://www.averageadmins.com/
  ___
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to [EMAIL PROTECTED]
  
  
 This sounds scary, I mean ok, but will doing what you have mentioned in
 this post do anything for the MBR?  Is that why I would be setting the
 bootable flag in fdisk?  I am currently using NTLOADER to boot Windows
 XP and FreeBSD 6.1-SECURITY.

There is a command line '-B' flag to fdisk that makes it write the MBR.
Setting the slice as bootable during the fdisk session just sets a 
flag for it.   Then in bsdlabel you need to tell it to write
the boot sector for that slice.   That flag is also '-B' but the one
in bsdlabel writes the slice's boot code and the one in fdisk writes
the whole drive's MBR.  Note that a drive's MBR runs, checks for
bootable slices, gives you a menu to choose bootable slices and when
you choose, loads the boot code from that slice and transfers control
to it.Actually, you don't really really need an MBR if there is
only one slice and it is bootable.  But, skip that.   Do it the whole
hog way.In the bsdlabel man page there is an example group of
commands that do just what you want - wipe the disk, fdisk it to
a single slice and do the bsdlabels (two of them in a row) to set
it up.   In the second one, you get an edit screen and in that you
set up the partition with identifiers and sizes you want.  When you
tell it to write and exit (standard 'ESC : w q' you use in vi) it
writes out the label.

From man bsdlabel: 
 dd if=/dev/zero of=/dev/da0 bs=512 count=32
 fdisk -BI da0
 dd if=/dev/zero of=/dev/da0s1 bs=512 count=32
 bsdlabel -w -B da0s1
 bsdlabel -e da0s1

The one block dd makes sure the disk is wiped and may not be needed.
I would skip the second dd -- I never use it.   Notice it is
referencing slice 1 on da0 whereas the first dd is referencing 
the drive itself without a slice.   The first one would nuke the MBR,
the second one would nuke the partition table and boot code on slice 1.

The first bsdlabel writes the boot code in slice 1.
The second bsdlabel sets up an edit session for the partition table.

After this, you just need to do a newfs for each partition you 
create except the one for swap (partition b).
Partition a should be root.
Partition label c is for the whole drive, not a real partition.
After a, b and c, the rest is up to you how to use the identifiers.

bsdlabel is much more forgiving about formats for partition sizes nodays, 
but I like to 

Re: Resizing Partitions, Losing Windows XP...

2006-09-22 Thread backyard


--- Jeff Cross [EMAIL PROTECTED] wrote:
 
 I really like the way I have my stuff setup within
 FreeBSD and would
 hate to have to recreate a lot of it as well as
 install applications
 over again.  Could I do a dump of my current FreeBSD
 partition, reformat
 and partition the whole drive, install FreeBSD, and
 then restore my data
 to the new partition or would this cause issues?
 
 Any assistance is greatly appreciated!
 
 Jeff Cross
 http://www.averageadmins.com/

 
Yes failrly easily you can back everything up to
tape

first you must find a suitable backup medium such as a
USB hard drive. 
I use a 5 gig seagate drive I picked up along the way.
This allows a typcial root, var and about 5.6 gig of
stuff on /usr. With compression things aught to work.
You might want to clean up /usr/ports/distfiles,
/usr/obj, and 
run a cd /usr/ports; make -DNOCLEANDEPENDS clean to
get rid of any unnecessary files, but this is up to
you.

then...

I would suggest booting to safe mode on your current
FreeBSD install first of all

then do a

#fsck -p
for paranoia

#swapon -a
for swap

# mount -a -o ro

to mount the partitions read only. this isn't required
but if the drives are rw you need -L as a switch to
the dump command below.
mount -u /tmp
dump will use /tmp

then mount you backup media whereever you want I will
use /mnt as my mount point I also assume you have
separate partions for each drive.

then this monster will backup everything

(dump -0 -C 32 -f - / | bzip2 | dd of=/mnt/root.dbz2)
 (dump -0 -C 32 -f - /var | bzip2 | dd
of=/mnt/var.dbz2)  (dump -0 -C 32 -f - /usr | bzip2
| dd of=/mnt/usr.dbz2)

then grab a coffee and wait for the tapes to be made.

now to restore there are better ways to do it but this
method has worked for me...

reboot with the FreeBSD install disk

go to fdisk and delete the old slices and create the
new slice. Use all disk, I would not do this
dangerously dedicated keep it compatible I've had boot
issues with boot drives in dangerously dedicated mode.
hit w to write the table it will ask if you are sure
say yes and install the boot loader you want, standard
MBR or the boot manager, your choice.

reboot

load up the cd and do bsdlabel mode
setup root, usr, var, tmp, swap whatever you use as a
partitioning scheme. this tool will require a root
partitio to be specified to work. then w to write the
label

now go to fixit mode on the cd and you'll be at a
prompt. if your backup media was Fat32, ext2,
basically anything but UFS1 or 2 you will type
sysctl kern.module_path=/dist/boot/kernel to let the
kernel find the right modules to support fat32 then I
generally do a mkdir /TAPE and mount the backup media
there. you should also have the swap already loaded
and root will be mounted on /mnt usr will be /mnt/usr
and var will be /mnt/var
next type 

#mdconfig -a -t swap -s 512m

this will give you a md node prolly md1 512m is what I
use (512 mb of swap) but less may work fine.

#newfs md1

mkdir /junk; mount /dev/md1 /junk; cp /tmp/* /junk/;
umount /junk; mount /dev/md1 /tmp

restore will need this tmp directory to have space or
things will get messy

then I would 
#umount /mnt/var /mnt/usr /mnt 

then I usually reformat the partitions to get rid of
annoying error messages about directories alrady being
present during the restore

#newfs -O 2 -L root -n /dev/ad0s1a (adjust your device


as required the -L option isn't necessary

#newfs -0 2 -L var -U -n /dev/ad0s1d
#newfs =O 2 -L usr -U -n /dev/ad0s1e

again adust the devices as required

then remount root to /mnt
then
#bzip2 -dc /TAPE/root.dbz2 | (cd /mnt; restore -r -f
-)
mount var and usr then repeat for them with cd
/mnt/usr and cd /mnt/var as required. make any
changes to /mnt/etc/fstab as required, unmount
everything and you should be good to go for a reboot.
you may get some expected 23423234 got 234253546
messages in the restore. a few of them aren't a
problem. As suggested by others MAKE SURE YOUR DUMPS
ARE GOOD PRIOR TO DOING THE RESLICING AND
PARTITIONING you can use that restore command to
restore to whereever you want with the right change
dir so find some free space and doit. even if you run
a newfs on the windows slice and mount it unlabeled
just to see the dumps are good, and assuming you don't
care about windows being lost.

after the reboot delete the restoresymtable files on
each of the filesystems 

of course if you know fdisk and bsdlabel from the
command line using a freesbie live cd would prolly
make this easier and not require a reboot after the
fdisk...

I have had issues with the drives being able to boot
up  so I generally like to use grub. so readup on
manually installing the MBR or boot manager just in
case. I think my last restore I just chose the
standard MBR and everything went fine.

good luck

-brian
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]