Re: gpart, slice starts at 0
On Sun, 17 Feb 2013, Erich Dollansky wrote: gpart destroy -F da0 diskinfo da0 dd if=/dev/zero of=/dev/da0 bs=512 count=34 dd if=/dev/zero of=/dev/da0 bs=512 count=34 seek=312581774 Someone here on the lists (I unfortunately forget who) showed a sneaky easier way to do this: gpart destroy -F da0 gpart create -s gpt da0 gpart destroy -F da0 This did not make a difference. It's an easier way to destroy the backup table at the end of the disk, whether one was there before or not, without having to calculate the location. gpart show -p da0 gpart create -s MBR da0 gpart add -t freebsd da0 gpart show -p da0 gpart show -p da0s1 gpart set -a active -i 1 da0 # # The following line always gives an error: # # gpart create -s BSD da0s1 'destroy' is not recursive. It destroys the geom found on the device given, but does not write to any geoms inside those geoms. This is obvious. What surprises me is that create does not write a new and empty description to the disk. It does, but not being recursive, it does not destroy the geoms inside the one given to the command (da0). You had: da0 (MBR) da0s1 (bsdlabel) After the destroy, it became da0 (null) da0s1 (bsdlabel) This can happen with any of the setups where there are geoms inside other geoms. The second part of your question, about da0 starting a block zero: [X220]...Appl/Some Tools (root) gpart show da0 = 63 312581745 da0 MBR (149G) 63 3125817451 freebsd [active] (149G) [X220]...Appl/Some Tools (root) gpart show da0s1 =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) That shows slice one starts at block 63, standard for MBR. The space inside the slice (da0s1) starts at block 0 *of the slice*. This is a bit confusing for me but it does not really matter as long as the programs get it straight. This is again because of the geom inside a geom setup. The actual start block is the start of the slice (block 63) plus the start of the FreeBSD partition inside the slice (currently 0). When you create FreeBSD partitions inside da0s1, they will have nonzero offsets from the start of the slice. There are examples shown here: http://forums.freebsd.org/showpost.php?p=206204postcount=11 ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: gpart, slice starts at 0
Hi, On Sun, 17 Feb 2013 09:11:48 -0700 (MST) Warren Block wbl...@wonkity.com wrote: On Sun, 17 Feb 2013, Erich Dollansky wrote: gpart destroy -F da0 diskinfo da0 dd if=/dev/zero of=/dev/da0 bs=512 count=34 dd if=/dev/zero of=/dev/da0 bs=512 count=34 seek=312581774 Someone here on the lists (I unfortunately forget who) showed a sneaky easier way to do this: gpart destroy -F da0 gpart create -s gpt da0 gpart destroy -F da0 This did not make a difference. It's an easier way to destroy the backup table at the end of the disk, whether one was there before or not, without having to calculate the location. ok, so, I should keep this then. gpart show -p da0 gpart create -s MBR da0 gpart add -t freebsd da0 gpart show -p da0 gpart show -p da0s1 gpart set -a active -i 1 da0 # # The following line always gives an error: # # gpart create -s BSD da0s1 'destroy' is not recursive. It destroys the geom found on the device given, but does not write to any geoms inside those geoms. This is obvious. What surprises me is that create does not write a new and empty description to the disk. It does, but not being recursive, it does not destroy the geoms inside the one given to the command (da0). You had: da0 (MBR) da0s1 (bsdlabel) After the destroy, it became da0 (null) da0s1 (bsdlabel) It seems that we talk here about the same with very different words. The effect comes from the fact that the entries are always on the same location on a disk. The advantage is that repartitioning a disk stills leaves some room for recovery. This can happen with any of the setups where there are geoms inside other geoms. The second part of your question, about da0 starting a block zero: [X220]...Appl/Some Tools (root) gpart show da0 = 63 312581745 da0 MBR (149G) 63 3125817451 freebsd [active] (149G) [X220]...Appl/Some Tools (root) gpart show da0s1 =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) That shows slice one starts at block 63, standard for MBR. The space inside the slice (da0s1) starts at block 0 *of the slice*. This is a bit confusing for me but it does not really matter as long as the programs get it straight. This is again because of the geom inside a geom setup. The actual start block is the start of the slice (block 63) plus the start of the FreeBSD partition inside the slice (currently 0). When you create FreeBSD partitions inside da0s1, they will have nonzero offsets from the start of the slice. There are examples shown here: http://forums.freebsd.org/showpost.php?p=206204postcount=11 And I saw there how to overcome the alignment problems. It is so simple. Just understanding it was not so simple for me. Thanks! Erich ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
gpart, slice starts at 0
Hi, I did this to get a disk partitioned: #!/bin/tcsh ### # # File name:FormatSamsung160GB # # Description: This script formats a thumb drive connected as da0 # ### # gpart destroy -F da0 diskinfo da0 dd if=/dev/zero of=/dev/da0 bs=512 count=34 dd if=/dev/zero of=/dev/da0 bs=512 count=34 seek=312581774 gpart show -p da0 gpart create -s MBR da0 gpart add -t freebsd da0 gpart show -p da0 gpart show -p da0s1 gpart set -a active -i 1 da0 # # The following line always gives an error: # # gpart create -s BSD da0s1 gpart bootcode -b /boot/mbr da0 gpart bootcode -b /boot/boot da0s1 gpart show -p da0 gpart show -p da0s1 gpart add -t freebsd-ufs -s 512MB -l Samsung160GBroot da0s1 The script results in this output: FormatSamsung160GB da0 destroyed da0 512 160041885696312581808 0 0 19457 255 63 34+0 records in 34+0 records out 17408 bytes transferred in 0.012732 secs (1367260 bytes/sec) 34+0 records in 34+0 records out 17408 bytes transferred in 0.023717 secs (733983 bytes/sec) gpart: No such geom: da0. da0 created da0s1 added = 63 312581745da0 MBR (149G) 63 312581745 da0s1 freebsd (149G) =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) active set on da0s1 bootcode written to da0 bootcode written to da0s1 = 63 312581745da0 MBR (149G) 63 312581745 da0s1 freebsd [active] (149G) =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) gpart: Invalid argument [X220]...Appl/Some Tools (root) gpart show da0 = 63 312581745 da0 MBR (149G) 63 3125817451 freebsd [active] (149G) [X220]...Appl/Some Tools (root) gpart show da0s1 =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) I have now two problems which I do not understand. First, why do I need this line and why does it fail? gpart create -s BSD da0s1 Second, why does this slice start at 0? =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) I use this as an starting point: http://www.wonkity.com/~wblock/docs/html/disksetup.html It worked for me some time ago. Did I miss something very, very simple? Erich ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: gpart, slice starts at 0
Hi, On Sat, 16 Feb 2013 14:51:22 +0700 Erich Dollansky er...@alogt.com wrote: I did this to get a disk partitioned: #!/bin/tcsh ### # # File name: FormatSamsung160GB # # Description:This script formats a thumb drive connected as da0 # ### # gpart destroy -F da0 diskinfo da0 dd if=/dev/zero of=/dev/da0 bs=512 count=34 dd if=/dev/zero of=/dev/da0 bs=512 count=34 seek=312581774 if I wipe out 100% of the disk here, it all works as expected. Can we assume that there is a problem in gpart? Erich gpart show -p da0 gpart create -s MBR da0 gpart add -t freebsd da0 gpart show -p da0 gpart show -p da0s1 gpart set -a active -i 1 da0 # # The following line always gives an error: # # gpart create -s BSD da0s1 gpart bootcode -b /boot/mbr da0 gpart bootcode -b /boot/boot da0s1 gpart show -p da0 gpart show -p da0s1 gpart add -t freebsd-ufs -s 512MB -l Samsung160GBroot da0s1 The script results in this output: FormatSamsung160GB da0 destroyed da0 512 160041885696312581808 0 0 19457 255 63 34+0 records in 34+0 records out 17408 bytes transferred in 0.012732 secs (1367260 bytes/sec) 34+0 records in 34+0 records out 17408 bytes transferred in 0.023717 secs (733983 bytes/sec) gpart: No such geom: da0. da0 created da0s1 added = 63 312581745da0 MBR (149G) 63 312581745 da0s1 freebsd (149G) =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) active set on da0s1 bootcode written to da0 bootcode written to da0s1 = 63 312581745da0 MBR (149G) 63 312581745 da0s1 freebsd [active] (149G) =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) gpart: Invalid argument [X220]...Appl/Some Tools (root) gpart show da0 = 63 312581745 da0 MBR (149G) 63 3125817451 freebsd [active] (149G) [X220]...Appl/Some Tools (root) gpart show da0s1 =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) I have now two problems which I do not understand. First, why do I need this line and why does it fail? gpart create -s BSD da0s1 Second, why does this slice start at 0? =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) I use this as an starting point: http://www.wonkity.com/~wblock/docs/html/disksetup.html It worked for me some time ago. Did I miss something very, very simple? Erich ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: gpart, slice starts at 0
On Sat, 16 Feb 2013, Erich Dollansky wrote: I did this to get a disk partitioned: #!/bin/tcsh Gah! gpart destroy -F da0 diskinfo da0 dd if=/dev/zero of=/dev/da0 bs=512 count=34 dd if=/dev/zero of=/dev/da0 bs=512 count=34 seek=312581774 Someone here on the lists (I unfortunately forget who) showed a sneaky easier way to do this: gpart destroy -F da0 gpart create -s gpt da0 gpart destroy -F da0 gpart show -p da0 gpart create -s MBR da0 gpart add -t freebsd da0 gpart show -p da0 gpart show -p da0s1 gpart set -a active -i 1 da0 # # The following line always gives an error: # # gpart create -s BSD da0s1 'destroy' is not recursive. It destroys the geom found on the device given, but does not write to any geoms inside those geoms. MBR/bsdlabel puts FreeBSD partitions inside MBR slices. So da0 has been erased, but the bsdlabel blocks for da0s1 are still present. If you recreate da0, da0s1 will magically reappear. Destroy the FreeBSD disklabel stuff in the slices first: gpart destroy -F da0s1 Or instead, use GPT partitioning to avoid dealing with the problem of one type of partitions inside a different type of partitions. GPT makes disk partitioning a lot easier. The second part of your question, about da0 starting a block zero: [X220]...Appl/Some Tools (root) gpart show da0 = 63 312581745 da0 MBR (149G) 63 3125817451 freebsd [active] (149G) [X220]...Appl/Some Tools (root) gpart show da0s1 =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) That shows slice one starts at block 63, standard for MBR. The space inside the slice (da0s1) starts at block 0 *of the slice*. ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: gpart, slice starts at 0
Hi, On Sat, 16 Feb 2013 08:44:50 -0700 (MST) Warren Block wbl...@wonkity.com wrote: On Sat, 16 Feb 2013, Erich Dollansky wrote: I did this to get a disk partitioned: #!/bin/tcsh Gah! it is a generated script. gpart destroy -F da0 diskinfo da0 dd if=/dev/zero of=/dev/da0 bs=512 count=34 dd if=/dev/zero of=/dev/da0 bs=512 count=34 seek=312581774 Someone here on the lists (I unfortunately forget who) showed a sneaky easier way to do this: gpart destroy -F da0 gpart create -s gpt da0 gpart destroy -F da0 This did not make a difference. gpart show -p da0 gpart create -s MBR da0 gpart add -t freebsd da0 gpart show -p da0 gpart show -p da0s1 gpart set -a active -i 1 da0 # # The following line always gives an error: # # gpart create -s BSD da0s1 'destroy' is not recursive. It destroys the geom found on the device given, but does not write to any geoms inside those geoms. This is obvious. What surprises me is that create does not write a new and empty description to the disk. MBR/bsdlabel puts FreeBSD partitions inside MBR slices. So da0 has been erased, but the bsdlabel blocks for da0s1 are still present. If you recreate da0, da0s1 will magically reappear. This is what I struggeled with all the time. Destroy the FreeBSD disklabel stuff in the slices first: gpart destroy -F da0s1 And this was the solution. Thanks! Or instead, use GPT partitioning to avoid dealing with the problem of one type of partitions inside a different type of partitions. GPT makes disk partitioning a lot easier. I am bit tired of having to read handbooks/manuals whenever I get a new device. Out of this, I am currently writing a small program which allows me easy 'formatting' of the device. MBR is just one option the program has. I will publish it when it is really working as I want it to. It will take some time as I do this on the side only. The second part of your question, about da0 starting a block zero: [X220]...Appl/Some Tools (root) gpart show da0 = 63 312581745 da0 MBR (149G) 63 3125817451 freebsd [active] (149G) [X220]...Appl/Some Tools (root) gpart show da0s1 =0 312581745 da0s1 BSD (149G) 0 312581745 - free - (149G) That shows slice one starts at block 63, standard for MBR. The space inside the slice (da0s1) starts at block 0 *of the slice*. This is a bit confusing for me but it does not really matter as long as the programs get it straight. Erich ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org