Re: restoring disklabel from an active disk?

2002-07-25 Thread Jerry McAllister

> 
> I somehow wiped out my disklabel and while I am backing up my home 
> directory in the event I need to start from scratch, I would like 
> know if I can somehow extract a valid disklabel from a running 
> system and re-apply it?

If you can get disklabel to print out the incore version of the label
and it looks correct, just pipe that output to a file and then use
that file as input to write the label.  It is pretty well spelled
out in the man page for disklabel.   If you use the file, you don't
need much else, just tell it to write the on disk copy of the label
and not just update the in core label.  It's all there.

In fact, it can be handy to keep a copy of your disklabels in
files on some other easily accessible online storage for such occasions.

jerry

> 
> I have everything mounted.
> Filesystem1K-blocksUsed   Avail Capacity  Mounted on
> /dev/ad0s2a  128990   42770   7590236%/
> /dev/ad0s2f  257998 532  236828 0%/tmp
> /dev/ad0s2g 7179502 5481904 112323883%/usr
> /dev/ad0s2e  257998  225462   1189895%/var
> procfs4   4   0   100%/proc
> 
> and disklabel offers to apply this information to the disk, but 
> I'm not sure it's right: there was an NTFS partition covering the 
> first 4 Gb. So starting from 0 doesn't look right to me. But then 
> that is slice 2 . . . .
> 
> 8 partitions:
> #size   offsetfstype   [fsize bsize bps/cpg]
>a:   26214404.2BSD 2048 1638494   # (Cyl. 
>0 - 17*)
>b:   492720   262144  swap# (Cyl. 
>   17*- 49*)
>c: 163900800unused0 0 # (Cyl. 
>0 - 1083)
>e:   524288   7548644.2BSD 2048 1638494   # (Cyl. 
>   49*- 84*)
>f:   524288  12791524.2BSD 2048 1638494   # (Cyl. 
>   84*- 119*)
>g: 14586640  18034404.2BSD 2048 1638489   # (Cyl. 
> 119*- 1083*)
> 
> I guess what I need is how to map the mounted filesystems to the 
> right disklabel values.
> 
> I'm not on the list, so direct replies would be most helpful.
> 
> Thanks.
> 
> -- 
> Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
> paulbeard [at] mac [ dot] com / 206 529 8400
> 
> http://paulbeard.no-ip.org/movabletype
> 
> Any sufficiently advanced technology is indistinguishable from magic.
>   -- Arthur C. Clarke
> 
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-questions" in the body of the message
> 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: restoring disklabel from an active disk?

2002-07-25 Thread Jerry McAllister

> 
> yup, I got the part about the incore label but too late: I wish 
> there was some way to refresh it. It is "active" as far as df -k 
> or the mechanism in the kernel that tracks filesystems knows.

Hmmm.  I just thought of something.  You say the disklabel starts
at 0.  Do you mean the offset?   That is the normal place to start.
That is 0 relative to the slice it is in, not the cylinder, track,
sector.   

The only things you really need to pay much attention to in the part 
of the disklabel output regarding the "partitions" are the partition 
letter, the size, the offset and the fstype.  (There are a couple of 
other things in the list before that that need to be correct, but 
they normally are figured out correctly by the system so just keep 
those values - you can add a label name if you like).

So, if it is just the offset that starts at 0 you might still be
in good shape.  

jerry

> 
> Jerry McAllister wrote:
> >>I seem not to have that anymore: the disklabel that I get back 
> >>starts at 0. I seem to have trashed that as well while I was 
> >>thrashing around with this. 
> > 
> > 
> > Oh Oh,  Sounds suspiciosly like it be gone then.   Well, this is
> > your opportunity to be creative...
> > 
> > jerry
> > 
> > 
> >>I take the point about writing the output of disklabel to a file 
> >>AND lpr much more seriously than I did this morning.
> >>
> >>Thanks.
> >>
> >>Jerry McAllister wrote:
> >>
> I somehow wiped out my disklabel and while I am backing up my home 
> directory in the event I need to start from scratch, I would like 
> know if I can somehow extract a valid disklabel from a running 
> system and re-apply it?
> >>>
> >>>
> >>>If you can get disklabel to print out the incore version of the label
> >>>and it looks correct, just pipe that output to a file and then use
> >>>that file as input to write the label.  It is pretty well spelled
> >>>out in the man page for disklabel.   If you use the file, you don't
> >>>need much else, just tell it to write the on disk copy of the label
> >>>and not just update the in core label.  It's all there.
> >>>
> >>>In fact, it can be handy to keep a copy of your disklabels in
> >>>files on some other easily accessible online storage for such occasions.
> >>>
> >>>jerry
> >>>
> >>>
> >>>
> I have everything mounted.
> Filesystem1K-blocksUsed   Avail Capacity  Mounted on
> /dev/ad0s2a  128990   42770   7590236%/
> /dev/ad0s2f  257998 532  236828 0%/tmp
> /dev/ad0s2g 7179502 5481904 112323883%/usr
> /dev/ad0s2e  257998  225462   1189895%/var
> procfs4   4   0   100%/proc
> 
> and disklabel offers to apply this information to the disk, but 
> I'm not sure it's right: there was an NTFS partition covering the 
> first 4 Gb. So starting from 0 doesn't look right to me. But then 
> that is slice 2 . . . .
> 
> 8 partitions:
> #size   offsetfstype   [fsize bsize bps/cpg]
>   a:   26214404.2BSD 2048 1638494   # (Cyl. 
>   0 - 17*)
>   b:   492720   262144  swap# (Cyl. 
>  17*- 49*)
>   c: 163900800unused0 0 # (Cyl. 
>   0 - 1083)
>   e:   524288   7548644.2BSD 2048 1638494   # (Cyl. 
>  49*- 84*)
>   f:   524288  12791524.2BSD 2048 1638494   # (Cyl. 
>  84*- 119*)
>   g: 14586640  18034404.2BSD 2048 1638489   # (Cyl. 
> 119*- 1083*)
> 
> I guess what I need is how to map the mounted filesystems to the 
> right disklabel values.
> 
> I'm not on the list, so direct replies would be most helpful.
> 
> Thanks.
> 
> -- 
> Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
> paulbeard [at] mac [ dot] com / 206 529 8400
> 
> http://paulbeard.no-ip.org/movabletype
> 
> Any sufficiently advanced technology is indistinguishable from magic.
>   -- Arthur C. Clarke
> 
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-questions" in the body of the message
> 
> >>>
> >>>
> >>
> >>-- 
> >>Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
> >>paulbeard [at] mac [ dot] com / 206 529 8400
> >>
> >>http://paulbeard.no-ip.org/movabletype
> >>
> >>To the best of my recollection, Senator, I can't recall.
> >>
> >>
> > 
> > 
> 
> 
> -- 
> Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
> paulbeard [at] mac [ dot] com / 206 529 8400
> 
> http://paulbeard.no-ip.org/movabletype
> 
> Stop searching.  Happiness is right next to you.  Now, if they'd only
> take a bath ...
> 
> 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: restoring disklabel from an active disk?

2002-07-25 Thread paul beard

I seem not to have that anymore: the disklabel that I get back 
starts at 0. I seem to have trashed that as well while I was 
thrashing around with this. 

I take the point about writing the output of disklabel to a file 
AND lpr much more seriously than I did this morning.

Thanks.

Jerry McAllister wrote:
>>I somehow wiped out my disklabel and while I am backing up my home 
>>directory in the event I need to start from scratch, I would like 
>>know if I can somehow extract a valid disklabel from a running 
>>system and re-apply it?
> 
> 
> If you can get disklabel to print out the incore version of the label
> and it looks correct, just pipe that output to a file and then use
> that file as input to write the label.  It is pretty well spelled
> out in the man page for disklabel.   If you use the file, you don't
> need much else, just tell it to write the on disk copy of the label
> and not just update the in core label.  It's all there.
> 
> In fact, it can be handy to keep a copy of your disklabels in
> files on some other easily accessible online storage for such occasions.
> 
> jerry
> 
> 
>>I have everything mounted.
>>Filesystem1K-blocksUsed   Avail Capacity  Mounted on
>>/dev/ad0s2a  128990   42770   7590236%/
>>/dev/ad0s2f  257998 532  236828 0%/tmp
>>/dev/ad0s2g 7179502 5481904 112323883%/usr
>>/dev/ad0s2e  257998  225462   1189895%/var
>>procfs4   4   0   100%/proc
>>
>>and disklabel offers to apply this information to the disk, but 
>>I'm not sure it's right: there was an NTFS partition covering the 
>>first 4 Gb. So starting from 0 doesn't look right to me. But then 
>>that is slice 2 . . . .
>>
>>8 partitions:
>>#size   offsetfstype   [fsize bsize bps/cpg]
>>   a:   26214404.2BSD 2048 1638494   # (Cyl. 
>>   0 - 17*)
>>   b:   492720   262144  swap# (Cyl. 
>>  17*- 49*)
>>   c: 163900800unused0 0 # (Cyl. 
>>   0 - 1083)
>>   e:   524288   7548644.2BSD 2048 1638494   # (Cyl. 
>>  49*- 84*)
>>   f:   524288  12791524.2BSD 2048 1638494   # (Cyl. 
>>  84*- 119*)
>>   g: 14586640  18034404.2BSD 2048 1638489   # (Cyl. 
>>119*- 1083*)
>>
>>I guess what I need is how to map the mounted filesystems to the 
>>right disklabel values.
>>
>>I'm not on the list, so direct replies would be most helpful.
>>
>>Thanks.
>>
>>-- 
>>Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
>>paulbeard [at] mac [ dot] com / 206 529 8400
>>
>>http://paulbeard.no-ip.org/movabletype
>>
>>Any sufficiently advanced technology is indistinguishable from magic.
>>  -- Arthur C. Clarke
>>
>>
>>To Unsubscribe: send mail to [EMAIL PROTECTED]
>>with "unsubscribe freebsd-questions" in the body of the message
>>
> 
> 


-- 
Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
paulbeard [at] mac [ dot] com / 206 529 8400

http://paulbeard.no-ip.org/movabletype

To the best of my recollection, Senator, I can't recall.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: restoring disklabel from an active disk?

2002-07-25 Thread Jerry McAllister

> 
> I seem not to have that anymore: the disklabel that I get back 
> starts at 0. I seem to have trashed that as well while I was 
> thrashing around with this. 

Oh Oh,  Sounds suspiciosly like it be gone then.   Well, this is
your opportunity to be creative...

jerry

> 
> I take the point about writing the output of disklabel to a file 
> AND lpr much more seriously than I did this morning.
> 
> Thanks.
> 
> Jerry McAllister wrote:
> >>I somehow wiped out my disklabel and while I am backing up my home 
> >>directory in the event I need to start from scratch, I would like 
> >>know if I can somehow extract a valid disklabel from a running 
> >>system and re-apply it?
> > 
> > 
> > If you can get disklabel to print out the incore version of the label
> > and it looks correct, just pipe that output to a file and then use
> > that file as input to write the label.  It is pretty well spelled
> > out in the man page for disklabel.   If you use the file, you don't
> > need much else, just tell it to write the on disk copy of the label
> > and not just update the in core label.  It's all there.
> > 
> > In fact, it can be handy to keep a copy of your disklabels in
> > files on some other easily accessible online storage for such occasions.
> > 
> > jerry
> > 
> > 
> >>I have everything mounted.
> >>Filesystem1K-blocksUsed   Avail Capacity  Mounted on
> >>/dev/ad0s2a  128990   42770   7590236%/
> >>/dev/ad0s2f  257998 532  236828 0%/tmp
> >>/dev/ad0s2g 7179502 5481904 112323883%/usr
> >>/dev/ad0s2e  257998  225462   1189895%/var
> >>procfs4   4   0   100%/proc
> >>
> >>and disklabel offers to apply this information to the disk, but 
> >>I'm not sure it's right: there was an NTFS partition covering the 
> >>first 4 Gb. So starting from 0 doesn't look right to me. But then 
> >>that is slice 2 . . . .
> >>
> >>8 partitions:
> >>#size   offsetfstype   [fsize bsize bps/cpg]
> >>   a:   26214404.2BSD 2048 1638494   # (Cyl. 
> >>   0 - 17*)
> >>   b:   492720   262144  swap# (Cyl. 
> >>  17*- 49*)
> >>   c: 163900800unused0 0 # (Cyl. 
> >>   0 - 1083)
> >>   e:   524288   7548644.2BSD 2048 1638494   # (Cyl. 
> >>  49*- 84*)
> >>   f:   524288  12791524.2BSD 2048 1638494   # (Cyl. 
> >>  84*- 119*)
> >>   g: 14586640  18034404.2BSD 2048 1638489   # (Cyl. 
> >>119*- 1083*)
> >>
> >>I guess what I need is how to map the mounted filesystems to the 
> >>right disklabel values.
> >>
> >>I'm not on the list, so direct replies would be most helpful.
> >>
> >>Thanks.
> >>
> >>-- 
> >>Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
> >>paulbeard [at] mac [ dot] com / 206 529 8400
> >>
> >>http://paulbeard.no-ip.org/movabletype
> >>
> >>Any sufficiently advanced technology is indistinguishable from magic.
> >>-- Arthur C. Clarke
> >>
> >>
> >>To Unsubscribe: send mail to [EMAIL PROTECTED]
> >>with "unsubscribe freebsd-questions" in the body of the message
> >>
> > 
> > 
> 
> 
> -- 
> Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
> paulbeard [at] mac [ dot] com / 206 529 8400
> 
> http://paulbeard.no-ip.org/movabletype
> 
> To the best of my recollection, Senator, I can't recall.
> 
> 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: restoring disklabel from an active disk?

2002-07-25 Thread paul beard

Assuming I work out the partition sizes with the output of df -k,
is there a way to determine the starting point for the slice that
contains all my BSD partitions?

As long as I don't reboot, things seem to be hunky-dory, but
that's not the most practical way to continue.


-- 
Paul Beard / 8040 27th Ave NE / Seattle WA 98115 /
paulbeard [at] mac [ dot] com / 206 529 8400

http://paulbeard.no-ip.org/movabletype

Satellite Safety Tip #14:
If you see a bright streak in the sky coming at you, duck.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message