Re: How to safely merge two slices on harddisk?
Jerry McAllister wrote: In any case, do not use /stand/sysinstall for this. You need more direct control and should use disklabel directly. As mentioned in my previous posting use the command 'disklabel -e -r asd1s1' and then edit the tmp file Malcolm Kay wrote: A good chance it will work -- but pre-existing 'f' and 'g' data is lost. Thank you guys for your help. I actually did use sysinstall (sorry, Jerry) and mission is accomplished. Yes, indeed, I lost the data is the two merged partitions 'f' and 'g', but that was no problem; I needed to keep the data in all other partitions. Sysinstall did all that for me. Meanwhile I learned a lot more about disklabel, thanks to your comments. Great and many thanks, Rob. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to safely merge two slices on harddisk?
Jerry McAllister wrote: In any case, do not use /stand/sysinstall for this. You need more direct control and should use disklabel directly. As mentioned in my previous posting use the command 'disklabel -e -r asd1s1' and then edit the tmp file Malcolm Kay wrote: A good chance it will work -- but pre-existing 'f' and 'g' data is lost. Thank you guys for your help. I actually did use sysinstall (sorry, Jerry) and mission is accomplished. You are lucky. sysinstall makes some assumptions in the way it calls disklabel. Your situation fit neatly within those assumptions. Yes, indeed, I lost the data is the two merged partitions 'f' and 'g', but that was no problem; I needed to keep the data in all other partitions. Sysinstall did all that for me. Well, it just let you define those other partitions in the same way they were before so effectively it left them alone. Meanwhile I learned a lot more about disklabel, thanks to your comments. Great and many thanks, Disklabel is actually quite easy to use. The man page combined with the fdisk man page can be rather confusing. The approach to writing them seem rather convoluted to me. If I felt competent enough on the subject, I would take a shot at rewriting them, but there are two many details about the extra features I do no know about. But, the main stuff is reall quite straightforward to use. jerry Rob. ___ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to safely merge two slices on harddisk?
Malcolm Kay wrote: On Tue, 10 Feb 2004 04:19, Rob wrote: Malcolm, Thank you for your detailed answer to my question. Malcolm Kay wrote: On Mon, 9 Feb 2004 13:46, Rob wrote: Do not change the offset of 'f'. If 'g' does not physically follow 'f' on the disk then this is not going to work -- give up now!!! How can I find that out? Is it the slice order in the disk label editor from /stand/sysinstall : No! What you want is disklabel (see man page). On 5.x this seems to have been replaced by bsdlabel -- but I have no experience with 5.x. The disklabel output of the disk is: - # disklabel /dev/ad1s1c: [...zip...] 8 partitions: size offsetfstype [fsize bsize bps/cpg] c:1562963220unused0 0 # (Cyl.0 - 9728*) a: 20480004.2BSD0 0 0 # (Cyl.0 - 12*) e: 6348800 2048004.2BSD0 0 0 # (Cyl. 12*- 407*) f: 6348800 65536004.2BSD0 0 0 # (Cyl. 407*- 803*) g: 6348800 129024004.2BSD0 0 0 # (Cyl. 803*- 1198*) h: 614400 192512004.2BSD0 0 0 # (Cyl. 1198*- 1236*) b: 614400 198656004.2BSD 2048 1638491 # (Cyl. 1236*- 1274*) d:135816322 20484.2BSD0 0 0 # (Cyl. 1274*- 9728*) - I have put the partitions in a new order, such that the Cyl. counts are continuously running up. Am I right, that g physically follows f here? If so, that would mean I can merge f and g into one new partition of 6 Gb, right? I actually wonder if the label editor of /stand/sysinstall can do what I want. Since I now know that f and g are back-to-front partitions, I could remove them and create a single new one; when I write this to disk, I can let sysinstall also create a new filesystem on the newly merged partition. I know this is potentially dangerous, but this way I have already deleted the swap partition, created a new ufs partition instead and created a file system on that; all in sysinstall. I believe it is safe, as long as I do not run 'newfs' on the existing partitions. Or am I missing something important here? Thanks, Rob. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to safely merge two slices on harddisk?
On Wed, 11 Feb 2004 21:15, Rob wrote: Malcolm Kay wrote: On Tue, 10 Feb 2004 04:19, Rob wrote: Malcolm, Thank you for your detailed answer to my question. Malcolm Kay wrote: On Mon, 9 Feb 2004 13:46, Rob wrote: Do not change the offset of 'f'. If 'g' does not physically follow 'f' on the disk then this is not going to work -- give up now!!! How can I find that out? Is it the slice order in the disk label editor from /stand/sysinstall : No! What you want is disklabel (see man page). On 5.x this seems to have been replaced by bsdlabel -- but I have no experience with 5.x. The disklabel output of the disk is: - # disklabel /dev/ad1s1c: [...zip...] 8 partitions: size offsetfstype [fsize bsize bps/cpg] c:1562963220unused0 0 # (Cyl.0 - 9728*) a: 20480004.2BSD0 0 0 # (Cyl.0 - 12*) e: 6348800 2048004.2BSD0 0 0 # (Cyl. 12*- 407*) f: 6348800 65536004.2BSD0 0 0 # (Cyl. 407*- 803*) g: 6348800 129024004.2BSD0 0 0 # (Cyl. 803*- 1198*) h: 614400 192512004.2BSD0 0 0 # (Cyl. 1198*- 1236*) b: 614400 198656004.2BSD 2048 1638491 # (Cyl. 1236*- 1274*) d:135816322 20484.2BSD0 0 0 # (Cyl. 1274*- 9728*) - I have put the partitions in a new order, such that the Cyl. counts are continuously running up. Am I right, that g physically follows f here? If so, that would mean I can merge f and g into one new partition of 6 Gb, right? I hope you mean you put the list in a new order -- not the physical partitions! You'll notice the cylinder counts occur after a '#'; thus they have no real signifcance but are only (informative) comments. I actually wonder if the label editor of /stand/sysinstall can do what I want. Hmm, probably, but it is not always easy to know in detail what sysinstall will do. In my opinion it is much more robust to modify the table through disklabel. Since I now know that f and g are back-to-front partitions, I could remove them and create a single new one; when I write this to disk, I can let sysinstall also create a new filesystem on the newly merged partition. Yes you could, but this discards the data in both the partitions 'f' and 'g'. But you could make a copy of everything on 'g' to a new tree on 'f'. Now dismount 'g' and 'f'. Dump the output from fdisklabel to a file. Edit the file by removing the g: line. Change the size in the f: line from 6348800 to 12697600. Use disklabel to write the revised table to disk. Use growfs on partition 'f'. Remount partition'f'. Mission accomplished -- I hope. I know this is potentially dangerous, but this way I have already deleted the swap partition, created a new ufs partition instead and created a file system on that; all in sysinstall. I believe it is safe, as long as I do not run 'newfs' on the existing partitions. Or am I missing something important here? A good chance it will work -- but pre-existing 'f' and 'g' data is lost. Malcolm ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to safely merge two slices on harddisk?
Malcolm Kay wrote: On Tue, 10 Feb 2004 04:19, Rob wrote: Malcolm, Thank you for your detailed answer to my question. Malcolm Kay wrote: On Mon, 9 Feb 2004 13:46, Rob wrote: Do not change the offset of 'f'. If 'g' does not physically follow 'f' on the disk then this is not going to work -- give up now!!! How can I find that out? Is it the slice order in the disk label editor from /stand/sysinstall : No! What you want is disklabel (see man page). On 5.x this seems to have been replaced by bsdlabel -- but I have no experience with 5.x. The disklabel output of the disk is: - # disklabel /dev/ad1s1c: [...zip...] 8 partitions: size offsetfstype [fsize bsize bps/cpg] c:1562963220unused0 0 # (Cyl.0 - 9728*) a: 20480004.2BSD0 0 0 # (Cyl.0 - 12*) e: 6348800 2048004.2BSD0 0 0 # (Cyl. 12*- 407*) f: 6348800 65536004.2BSD0 0 0 # (Cyl. 407*- 803*) g: 6348800 129024004.2BSD0 0 0 # (Cyl. 803*- 1198*) h: 614400 192512004.2BSD0 0 0 # (Cyl. 1198*- 1236*) b: 614400 198656004.2BSD 2048 1638491 # (Cyl. 1236*- 1274*) d:135816322 20484.2BSD0 0 0 # (Cyl. 1274*- 9728*) - I have put the partitions in a new order, such that the Cyl. counts are continuously running up. Am I right, that g physically follows f here? If so, that would mean I can merge f and g into one new partition of 6 Gb, right? Do NOT pay any attention to the supposed cylinder counts out on the right. They are only comments and probably do not even reflect actual cylinder values. Although it just happens that those cylinder comments work out to appear in order, they are very unlikely to designate actual cylinders, but rather some form of virtual cylinder count (They may coincidentally look in order but are really meaningless - ignore the funny old man pulling strings behind the curtain) The ONLY relevant ordering would be one based on the order of the partitions' offsets - which, you have listed in ascending order. As I mentioned in a long description a day or so ago, the relevant information is found in the size and offset fields. They are the ONLY thing that will tell you if the partitions are adjacent and contiguous. In this case, since partition f: begins at 6553600 and is 6348800 blocks long and partition g: starts at 12902400 which is exactly the f: partition offset and size added up, it looks like those two partitions are adjacent and contiguous. I actually wonder if the label editor of /stand/sysinstall can do what I want. Since I now know that f and g are back-to-front partitions, I could remove them and create a single new one; when I write this to disk, I can let sysinstall also create a new filesystem on the newly merged partition. I know this is potentially dangerous, but this way I have already deleted the swap partition, created a new ufs partition instead and created a file system on that; all in sysinstall. I believe it is safe, as long as I do not run 'newfs' on the existing partitions. Probably safe, but backup everything anyway. It is dangerous to bet on tinkering with rewriting the label even if the parts you want to save are kept with the same values. The label is still completely rewritten. In any case, do not use /stand/sysinstall for this. You need more direct control and should use disklabel directly. As mentioned in my previous posting use the command 'disklabel -e -r asd1s1' and then edit the tmp file it puts up and then write[save] it back. This is the most directly reliable way to do it. Since the drive is not a boot drive you don't need any other switches of flags although you may want to try it onece with the -n switch just to see what happens without actually writing anything to the real label. jerry Or am I missing something important here? The real value of backing up everything and redoing the whole disk from scratch. /jrm Thanks, Rob. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to safely merge two slices on harddisk?
On Tue, 10 Feb 2004 04:19, Rob wrote: Malcolm, Thank you for your detailed answer to my question. Malcolm Kay wrote: On Mon, 9 Feb 2004 13:46, Rob wrote: Do not change the offset of 'f'. If 'g' does not physically follow 'f' on the disk then this is not going to work -- give up now!!! How can I find that out? Is it the slice order in the disk label editor from /stand/sysinstall : No! What you want is disklabel (see man page). On 5.x this seems to have been replaced by bsdlabel -- but I have no experience with 5.x. You can first gather the partition information; and later when you decide what you want to do you can modify the table using this utility. It shows partition sizes and offsets in sectors; and assists in editing these. But if you don't already know of this utility then tread very carefully. Even small fiddles if you don't know what you are doing can make it almost impossible to recover any of the information in the slice. Disk: ad1 Partition name: ad1s1 Free: 0 blocks (0MB) Part Mount Size Newfs - - ad1s1anone100MB * ad1s1enone 3100MB * ad1s1fnone 3100MB * ad1s1gnone 3100MB * ad1s1hnone300MB * ad1s1bnone300MB * ad1s1dnone 66316MB * In this table f and g are back-to-front lined up. Does that mean f physically follows g? Asking a question and giving a non-existent email address is quite rude. Sorry, but I consider a potential spam risk when using a real address on this publicly accessible list. The list is my communication medium and I monitor the list on gmane. I hope you understand. Of course spam occurs but almost everyone else on the list posts a genuine e-mail address. Why should you get special privileges? Malcolm Kay ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to safely merge two slices on harddisk?
On Mon, 9 Feb 2004 13:46, Rob wrote: Hi, I have a hard disk, on which I would like to merge two slices into one single slice. The disk slices are as follows: /dev/ad1s1a98M43M47M48%/home/userB /dev/ad1s1d64G45G14G77%/home/userA /dev/ad1s1e 3.0G 2.5G 282M90%/home/userC /dev/ad1s1f 3.0G 1.0G 1.7G37%/usr/ports /dev/ad1s1g 3.0G 268M 2.5G10%/mnt /dev/ad1s1h 295M 295M -23.5M 109%/diskless_swap I want to merge /ad1s1f and /ad1s1g into one 6Gb slice. The merging should NOT destroy anything in the slices before (ad1s1a, d, and e), but destroying the data in the one afer (ad1s1h) is no problem. Is there a way to do this? What is the safest one? (without having to backup the whole disk). Any manipulation at this level is risky. To do so without first taking a backup endangers all your data. But once you have the assurance of a backup you could copy all the information from /mnt into some new tree in /usr/ports. That is a tree copy of the content of /dev/ad1s1g to a new tree on /dev/ad1s1f. cp -Rp /mnt /usr/ports/newtree Having done that partition /dev/ad1s1g becomes free and you can rebuild the disk label using disklabel to eliminate the 'g' partition and extend the size of the 'f' partitition to take up the extra space. But first umount the 'f' and 'g' partitions. CAUTION Do not change the offset of 'f'. If 'g' does not physically follow 'f' on the disk then this is not going to work -- give up now!!! If all has gone well so far you should now be able to use growfs on /dev/ad1s1f to expand the file system to fill the partition. Remount the 'f' partition and you should be back in business. If you want to find what was on /dev/ad1s1g with the original path then rm /mnt ln -s /usr/ports/newtree /mnt If you are on 5.x then be warned that I have no experience with these versions of FBSD. And in any case I have never, myself, had occassion to use growfs. Malcolm ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to safely merge two slices on harddisk?
On Mon, 9 Feb 2004 22:25, Malcolm Kay wrote: On Mon, 9 Feb 2004 13:46, Rob wrote: Hi, I have a hard disk, on which I would like to merge two slices into one single slice. The disk slices are as follows: /dev/ad1s1a98M43M47M48%/home/userB /dev/ad1s1d64G45G14G77%/home/userA /dev/ad1s1e 3.0G 2.5G 282M90%/home/userC /dev/ad1s1f 3.0G 1.0G 1.7G37%/usr/ports /dev/ad1s1g 3.0G 268M 2.5G10%/mnt /dev/ad1s1h 295M 295M -23.5M 109%/diskless_swap I want to merge /ad1s1f and /ad1s1g into one 6Gb slice. The merging should NOT destroy anything in the slices before (ad1s1a, d, and e), but destroying the data in the one afer (ad1s1h) is no problem. Is there a way to do this? What is the safest one? (without having to backup the whole disk). Any manipulation at this level is risky. To do so without first taking a backup endangers all your data. But once you have the assurance of a backup you could copy all the information from /mnt into some new tree in /usr/ports. That is a tree copy of the content of /dev/ad1s1g to a new tree on /dev/ad1s1f. cp -Rp /mnt /usr/ports/newtree Having done that partition /dev/ad1s1g becomes free and you can rebuild the disk label using disklabel to eliminate the 'g' partition and extend the size of the 'f' partitition to take up the extra space. But first umount the 'f' and 'g' partitions. CAUTION Do not change the offset of 'f'. If 'g' does not physically follow 'f' on the disk then this is not going to work -- give up now!!! If all has gone well so far you should now be able to use growfs on /dev/ad1s1f to expand the file system to fill the partition. Remount the 'f' partition and you should be back in business. If you want to find what was on /dev/ad1s1g with the original path then rm /mnt Should of course be: rmdir /mnt ln -s /usr/ports/newtree /mnt If you are on 5.x then be warned that I have no experience with these versions of FBSD. And in any case I have never, myself, had occassion to use growfs. Malcolm ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to safely merge two slices on harddisk?
On Mon, 9 Feb 2004 13:46, Rob wrote: Hi, [snip] Rob. Asking a question and giving a non-existent email address Rob [EMAIL PROTECTED] is quite rude. Malcolm ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to safely merge two slices on harddisk?
Hi, I have a hard disk, on which I would like to merge two slices into one single slice. The disk slices are as follows: First, in the df output I see below, there is only one slice showing. That would be slice 1 of the /dev/ad1 disk eg. /dev/ad1s1. Second, it would be more useful in this case to post the output from disklabel because that would show the sector numbers of the two partitions (f and g) that you are talking about merging. Do:disklabel -r ad1s1 NOTE: df shows size estimates after all formatting and system reserves are taken out of the calculation, so it does not show the actual number of blocks that were used in creating the label for the disk. It also does not show unmounted partitions such as a possible swap partition. Here is a sample from one of my disks, (minus stock disk info stuff at the top). Note, where is says '8 partitions' it means you can defince up to 8 partitions, not that 8 partitions have been defined. Also NOTE: The size and offset values are given in 512 Byte blocks. 8 partitions: #size offsetfstype [fsize bsize bps/cpg] a: 104857604.2BSD 1024 819222 # (Cyl.0 - 65*) c: 355517820unused0 0 # (Cyl.0 - 2212*) f: 1048576 10485764.2BSD 1024 819222 # (Cyl. 65*- 130*) g: 6291456 20971524.2BSD 2048 1638489 # (Cyl. 130*- 522*) h: 27163174 83886084.2BSD 2048 1638489 # (Cyl. 522*- 2212*) /dev/ad1s1a98M43M47M48%/home/userB /dev/ad1s1d64G45G14G77%/home/userA /dev/ad1s1e 3.0G 2.5G 282M90%/home/userC /dev/ad1s1f 3.0G 1.0G 1.7G37%/usr/ports /dev/ad1s1g 3.0G 268M 2.5G10%/mnt /dev/ad1s1h 295M 295M -23.5M 109%/diskless_swap I want to merge /ad1s1f and /ad1s1g into one 6Gb slice. My inclination would be to make a good backup of the partitions that you want to preserve - regardless of what nice tricks you want to use and whether they should be safe. Then, when you have good backups done, the best and easiest thing to do would be to re-partition the whole /dev/ad1s1 slice and then reload from backups. But, once you have the backups, you might be able to just use disklabel to rewrite the label so the sectors in partitions f and g are combined in to a single partition f. The key thing to look for in the disklabel -r ad1s1 output is if the f: and g: partitions are truly adjacent and can be a contiguous single partition. This is probably, but it is possible that they are not. Nothing requires using partition labels in alphabetical order. So, add up the size fields of all the partitions before the ones in question. Presuming the above order and typical usage, that would be a: d:. If those sizes equal the offset of the f: partition then that part is OK. Then add in the size of the f: partition to the previous total and if that sum equals the offset value of the g: partition reported by disklabel, then you can be sure they are adjacent and contiguous. So, if you are so inclined, you can take a shot at it. But, if the size sums and offsets indicate that these two are not really adjacent, then you are stuck with complately re-labeling the ad1s1 slice. One improbable thing could come up. It is possible that there is some wasted space that was left out between the f: and g: partitions. If this is so, your size sums and offset values should tell you that. If this occurs, you can just roll that in to the combined f: and g: just by adjusting the size of the new f: partition. To try concatenating the two adjacent partitions do: disklabel -e -r ad1s1 (You could try it once first with -n (eg disklabel -e -r -n ad1s1) just to check and see what it would write) disklabel -d -r ad1s1 will put the label info in to a file of the exact format to feed back to disklabel. Then you can just edit it. When you get out of the file with a write/save it will write the label back to the disk. It will use any editor you have designated, but the default is vi. Example: You should see something like (based on wild guesses from your df above - I did not compensate for how much was taken out by newfs making superblocks, system reserves, unmounted partitions, etc, so these are not the real numbers): 8 partitions: #size offsetfstype [fsize bsize bps/cpg] a: 200704 0 4.2BSD1024 819222# (Cyl.0 - 65*) c: 153896960 0 unused 0 0 # (Cyl.0 - 2212*) d: 134217728 200704 4.2BSD2048 1638489# (Cyl.0-2212*) e: 6291456134418432 4.2BSD1024 819222# (Cyl.0-2212*) f: 6291456140709888 4.2BSD1024 819222# (Cyl. 65*- 130*) g: 6291456147001344 4.2BSD1024 819222# (Cyl. 130*- 522*) h: 604160 153292800 4.2BSD1024 819222# (Cyl. 522*- 2212*) Basically
Re: How to safely merge two slices on harddisk?
Malcolm, Thank you for your detailed answer to my question. Malcolm Kay wrote: On Mon, 9 Feb 2004 13:46, Rob wrote: Do not change the offset of 'f'. If 'g' does not physically follow 'f' on the disk then this is not going to work -- give up now!!! How can I find that out? Is it the slice order in the disk label editor from /stand/sysinstall : Disk: ad1 Partition name: ad1s1 Free: 0 blocks (0MB) Part Mount Size Newfs - - ad1s1anone100MB * ad1s1enone 3100MB * ad1s1fnone 3100MB * ad1s1gnone 3100MB * ad1s1hnone300MB * ad1s1bnone300MB * ad1s1dnone 66316MB * In this table f and g are back-to-front lined up. Does that mean f physically follows g? Asking a question and giving a non-existent email address is quite rude. Sorry, but I consider a potential spam risk when using a real address on this publicly accessible list. The list is my communication medium and I monitor the list on gmane. I hope you understand. Cheers, Rob. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
How to safely merge two slices on harddisk?
Hi, I have a hard disk, on which I would like to merge two slices into one single slice. The disk slices are as follows: /dev/ad1s1a98M43M47M48%/home/userB /dev/ad1s1d64G45G14G77%/home/userA /dev/ad1s1e 3.0G 2.5G 282M90%/home/userC /dev/ad1s1f 3.0G 1.0G 1.7G37%/usr/ports /dev/ad1s1g 3.0G 268M 2.5G10%/mnt /dev/ad1s1h 295M 295M -23.5M 109%/diskless_swap I want to merge /ad1s1f and /ad1s1g into one 6Gb slice. The merging should NOT destroy anything in the slices before (ad1s1a, d, and e), but destroying the data in the one afer (ad1s1h) is no problem. Is there a way to do this? What is the safest one? (without having to backup the whole disk). Thanks, Rob. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]