Re: Spam ? - Re: Increasing partition size by removing partitions

2008-09-29 Thread Paul Wootton
I dont know if it going to be of any use, but in the past, I have used a free 
but very low level partition editing tool called Ranish 
http://www.ranish.com/part/

It does allow for moving of any partitions (or slices in BSD terms)

Watch out though, as there is no real checks done against commands you issue 
(It WILL do exactly what you ask - be it right or wrong)

I have used it (v2.44 - the lastest beta version) in the past for moving, 
growing and shrinking of NTFS and FAT32 partitions with a FreeBSD slice on the 
drive, just never tried changing a BSD slice it self

If I remember right, if you try to run the editor under windows 2000 or XP, it 
will try to create a bootable floppy disk which might be more useful to 
FreeBSD users

Like I said, it might not be any use in this instance, but probably still 
worth a look, just incase

Paul

On Sunday 28 September 2008 02:38:14 Maxim Khitrov wrote:
 On Sat, Sep 27, 2008 at 7:22 PM, Aryeh M. Friedman

 [EMAIL PROTECTED] wrote:
  I have a disk that is laid out with partion 0 being NTFS and 1 being
  FreeBSD.  I want to remove the NTFS partition and grow the FreeBSD one
  but all the docs I have seen only talk about how to do this if the new
  part of the partition is at the end of the partition you wish to grow.  
  How do I go about this?

 Assuming that there is no (free) software that will do it for you, and
 you are unable for some reason to move the data to another place and
 repartition the drive, you have to manually move your FreeBSD
 partition back and then extend it. I've never done this before, but if
 I had to try it the first time I would do the following:

 1. Try very hard to find some other hard drive where I can just dump
 the data and avoid this whole thing to begin with. :)
 2. Boot from a FreeBSD livecd, attach a usb drive for storing some
 temporary files and mount it under /mnt.
 3. Create a back-up of your master boot record (dd if=/dev/ad0
 of=/mnt/mbr-backup bs=512 count=1). Assuming here that your drive is
 ad0.
 4. Use fdisk to get the start and size values of your two partitions
 (in sectors).
 5. Erase the ntfs partition (dd if=/dev/zero of=/dev/ad0s1 bs=2m).
 6. Copy your FreeBSD partition to the former start location of ntfs
 (dd if=/dev/ad0 of=/dev/ad0 bs=512 iseek=start of partition 2
 oseek=start of partition 1 count=size of partition 2). Using
 bs=512 is slow, but it makes it easier for you to just take the
 numbers that fdisk gives you and plug them in.
 7. Once this is done you will need to edit your mbr sector to
 overwrite the first partition entry with the second, but certain
 fields will need to be updated...

 I recommend you use a hex editor and work on the file that you saved
 in step 3. You can try the same thing with a partition editor, but you
 may not get the desired results.

 For the manual (and more fun) method, the partition table begins at
 offset 0x01BE, and each entry is 16 bytes long. That means that you
 need to copy 16 bytes starting at address 0x01CE to address 0x01BE.
 However, before you do this, you need to set the correct values for
 cylinder-head-sector of first and last sectors in the FreeBSD
 partition, as well as the logical address of the first sector.

 First, take 3 bytes starting at address 0x01BF and copy them to
 0x01CF. This takes care of CHS start, which is unchanged. Next, take 4
 bytes at address 0x01C6 and copy them to 0x01D6. This is the logical
 sector start. The tricky bit is the CHS last sector value. If your two
 partitions were of identical size, then you can copy 3 bytes from
 0x01C3 to 0x01D3. Otherwise, you'll need to calculate the new values
 by hand. If your NTFS partition was marked as active before, then set
 byte 0x01CE to be 0x80.

 One this is done, copy that second record over the first and zero-out
 the 16 bytes at 0x01CE. Use dd again to copy the updated mbr sector to
 your drive. At this point your master boot record will have the
 correct entry for your FreeBSD partition, which was moved over the
 NTFS one. See if you can mount /dev/ad0s1a while still in the livecd
 environment (actually, you will need to reboot first). If ad0s1a is
 under /dev and you can mount it, then your mbr is fine. Use growfs
 from here and then boot from the hard drive.

 As you can see, it's not a trivial thing to do, but it's possible if
 you are careful. Once again, I've never done this and am basing the
 whole thing on some of my previous experience in messing with the
 master boot record. There may be some other things that I missed. I
 also don't know if there is existing software that might make this
 whole process much easier, the directions here are a worst-case
 scenario for moving your partition by hand.

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

___

Re: Increasing partition size by removing partitions

2008-09-28 Thread perryh
 I have a disk that is laid out with partion 0 being NTFS and 1
 being FreeBSD.  I want to remove the NTFS partition and grow the
 FreeBSD one but all the docs I have seen only talk about how to
 do this if the new part of the partition is at the end of the
 partition you wish to grow.  How do I go about this?

Partition Commander is aware of *BSD partitions and should be able
to do this.  (Granted it is payware.)

Delete the NTFS partition, move the FreeBSD partition (slice in
FreeBSD parlance) to the beginning of the drive, boot into FreeBSD
to make sure everything is working, then go ahead with the grow
operation as usual.

As always, it's highly recommended to make a full backup first.
Having done that, it may be easier to reslice the disk as FreeBSD
only and then restore the backup.

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


Re: Increasing partition size by removing partitions

2008-09-28 Thread Paul Schenkeveld
On Sat, Sep 27, 2008 at 07:22:20PM -0400, Aryeh M. Friedman wrote:
 I have a disk that is laid out with partion 0 being NTFS and 1 being 
 FreeBSD.  I want to remove the NTFS partition and grow the FreeBSD one but 
 all the docs I have seen only talk about how to do this if the new part of 
 the partition is at the end of the partition you wish to grow.   How do I 
 go about this?

For clarity, let's use the FreeBSD terminology and call these slices,
one NTFS slice and one FreeBSD slice.  Partitions are what go in the
FreeBSD slice (your root, swap, var and usr aprtitions).

Do you really need one big FreeBSD slice?  You could remove the NTFS
slice and create another FreeBSD slice in that place.

To make things workable, be sure to have a standard FreeBSD boot manager
in the MBR block by doing something like:

# fdisk -B -b /boot/boot0 ad0

Then you can create a disklabel in the new slice holding one or
more FreeBSD partitions.  Next newfs them and add them to /etc/fstab and
mount them.

All these steps could be done from the Configure submenu of sysinstall
if you're not familiar with the fdisk, bsdlabel and newfs commands.

The very brave among us could copy the existing FreeBSD partitions from
slice 2 to slice 1, enlarging them if needed and using fdisk and bsdlabel
to combine the two slices into one, all depending on the size of the
slices.  The big issue here is to be aware not to overwrite anything
before copying it into its final place.

Regards,

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


Increasing partition size by removing partitions

2008-09-27 Thread Aryeh M. Friedman
I have a disk that is laid out with partion 0 being NTFS and 1 being 
FreeBSD.  I want to remove the NTFS partition and grow the FreeBSD one 
but all the docs I have seen only talk about how to do this if the new 
part of the partition is at the end of the partition you wish to grow.   
How do I go about this?

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


Re: Increasing partition size by removing partitions

2008-09-27 Thread Jeremy Chadwick
On Sat, Sep 27, 2008 at 07:22:20PM -0400, Aryeh M. Friedman wrote:
 I have a disk that is laid out with partion 0 being NTFS and 1 being  
 FreeBSD.  I want to remove the NTFS partition and grow the FreeBSD one  
 but all the docs I have seen only talk about how to do this if the new  
 part of the partition is at the end of the partition you wish to grow.
 How do I go about this?

There isn't a way to do this, as far as I know.

-- 
| Jeremy Chadwickjdc at parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

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


Re: Increasing partition size by removing partitions

2008-09-27 Thread Maxim Khitrov
On Sat, Sep 27, 2008 at 7:22 PM, Aryeh M. Friedman
[EMAIL PROTECTED] wrote:
 I have a disk that is laid out with partion 0 being NTFS and 1 being
 FreeBSD.  I want to remove the NTFS partition and grow the FreeBSD one but
 all the docs I have seen only talk about how to do this if the new part of
 the partition is at the end of the partition you wish to grow.   How do I go
 about this?

Assuming that there is no (free) software that will do it for you, and
you are unable for some reason to move the data to another place and
repartition the drive, you have to manually move your FreeBSD
partition back and then extend it. I've never done this before, but if
I had to try it the first time I would do the following:

1. Try very hard to find some other hard drive where I can just dump
the data and avoid this whole thing to begin with. :)
2. Boot from a FreeBSD livecd, attach a usb drive for storing some
temporary files and mount it under /mnt.
3. Create a back-up of your master boot record (dd if=/dev/ad0
of=/mnt/mbr-backup bs=512 count=1). Assuming here that your drive is
ad0.
4. Use fdisk to get the start and size values of your two partitions
(in sectors).
5. Erase the ntfs partition (dd if=/dev/zero of=/dev/ad0s1 bs=2m).
6. Copy your FreeBSD partition to the former start location of ntfs
(dd if=/dev/ad0 of=/dev/ad0 bs=512 iseek=start of partition 2
oseek=start of partition 1 count=size of partition 2). Using
bs=512 is slow, but it makes it easier for you to just take the
numbers that fdisk gives you and plug them in.
7. Once this is done you will need to edit your mbr sector to
overwrite the first partition entry with the second, but certain
fields will need to be updated...

I recommend you use a hex editor and work on the file that you saved
in step 3. You can try the same thing with a partition editor, but you
may not get the desired results.

For the manual (and more fun) method, the partition table begins at
offset 0x01BE, and each entry is 16 bytes long. That means that you
need to copy 16 bytes starting at address 0x01CE to address 0x01BE.
However, before you do this, you need to set the correct values for
cylinder-head-sector of first and last sectors in the FreeBSD
partition, as well as the logical address of the first sector.

First, take 3 bytes starting at address 0x01BF and copy them to
0x01CF. This takes care of CHS start, which is unchanged. Next, take 4
bytes at address 0x01C6 and copy them to 0x01D6. This is the logical
sector start. The tricky bit is the CHS last sector value. If your two
partitions were of identical size, then you can copy 3 bytes from
0x01C3 to 0x01D3. Otherwise, you'll need to calculate the new values
by hand. If your NTFS partition was marked as active before, then set
byte 0x01CE to be 0x80.

One this is done, copy that second record over the first and zero-out
the 16 bytes at 0x01CE. Use dd again to copy the updated mbr sector to
your drive. At this point your master boot record will have the
correct entry for your FreeBSD partition, which was moved over the
NTFS one. See if you can mount /dev/ad0s1a while still in the livecd
environment (actually, you will need to reboot first). If ad0s1a is
under /dev and you can mount it, then your mbr is fine. Use growfs
from here and then boot from the hard drive.

As you can see, it's not a trivial thing to do, but it's possible if
you are careful. Once again, I've never done this and am basing the
whole thing on some of my previous experience in messing with the
master boot record. There may be some other things that I missed. I
also don't know if there is existing software that might make this
whole process much easier, the directions here are a worst-case
scenario for moving your partition by hand.

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