|
News,
Internal,
Projects,
Home Software, Support, Documentation |
¾ü±×Á¦ 15±â°¡±îÁö FreeBSD ÆÄƼ¼ÇÀÇ ·¹ÀÌºí¸¸ Ȧ¶û ³¯¾Æ°¡¹ö¸®´Â
±â°¡¸·È÷´Â »ç°í°¡ ¹ß»ýÇØ¼ Ȩ µð·ºÅ丮¸¦ ¸ù¶¥ ³¯¸±»· Çß½À´Ï´Ù. :<
´ÙÇàÈ÷µµ ´Ù¸¥ ÆÄƼ¼Ç¿¡ 3.5.1À» ±ò¾Æ¼ º¹±¸Çߴµ¥, ´Ù½Ã »ý°¢¸¸ ÇØµµ
¾ÆÂñÇϱº¿ä. Àؾî¸Ô±â Àü¿¡ °£´ÜÇÑ ÀýÂ÷¿¡ ´ëÇØ À̾߱âÇϰڽÀ´Ï´Ù.
1. »ç°í °³¿ä
ÆÄƼ¼ÇÀº ¸ÖÂÄÇѵ¥ µð½ºÅ©·¹À̺íÀÌ ¿Âµ¥°£µ¥ ¾øÀ½ :<
2. º¹±¸¹æ¹ý
´Ù¸¥ ÆÄƼ¼Ç¿¡ FreeBSD¸¦ ±ñ´Ù(ÀúÀÇ °æ¿ì 3.5.1).
sysutils/gpart¿Í ffsrecover¸¦ ¼³Ä¡ÇÑ´Ù.
gpart´Â PCÆÄƼ¼Ç ³¯¶ó°¬À» ¶§ µð½ºÅ© ³»¿ëÀ» º¸°í ÆÄƼ¼Ç ±¸¼ºÀ» ÃßÃøÇØ
ÁÖ´Â ÇÁ·Î±×·¥À̰í(À̰͵µ ÆÄƼ¼ÇÀÌ ³¯¶ó°¬À» ¶§¿¡´Â ¾ÆÁÖ ¾µ¸¸ÇÕ´Ï´Ù¸¸
ÀúÀÇ °æ¿ì PCÆÄƼ¼ÇÀº ¸ÖÂÄÇßÀ¸¹Ç·Î ¾ø¾îµµ OK), ffsrecover´Â ±úÁø ffs
ÆÄƼ¼Ç¿¡¼ ÆÄÀÏÀ» »ì·ÁÁÖ´Â ÇÁ·Î±×·¥Àε¥, Á¦°¡ ÀÌ¿ëÇÑ °Ç ±×Áß ¼öÆÛºí·°
Á¤º¸ º¸´Â °ÍÀÔ´Ï´Ù. ÀÌ°Ô µð½ºÅ© ÀåÄ¡¿¡ µ¿ÀÛÀ» ¾ÈÇÏ°í ÆÄÀÏ·Î µÈ µð½ºÅ©
À̹ÌÁö¿¡¸¸ µ¿ÀÛÇÏ´Â ¹Ù¶÷¿¡ Á¶±Ý ¾Ö¸¦ ¸Ô¾ú½À´Ï´Ù. ¼öÆÛºí·° Á¤º¸ º¸·Á¸é
dd if=/dev/wd0s2 of=ffs.img bs=512 count=500
Á¤µµ Çϰí¼(´ëÃæ ¾ÕºÎºÐ¸¸ ¶â´Â °Ì´Ï´Ù)
ffsrecover -p ffs.img
·Î º¸½Ã¸é ÇØ´ç ºí·°ÀÇ Å©±â´Â ¾Ë ¼ö ÀÖ½À´Ï´Ù(¼öÆÛºí·°ÀÌ ³¯¶ó°¬À¸¸é
´ëü ºí·°À» º¸¸é µÇ°ÚÁÒ. º¸Åë 0, 32, ÀÌ·±½ÄÀ¸·Î µÇ´Ï±î 32¹øÂ° ºí·°À»
ºÁµµ µË´Ï´Ù)
±× ´ÙÀ½, ·¹ÀÌºí »ì¸®±â.
·¹À̺íÀº ÇϳªÀÇ FFS ÆÄƼ¼ÇÀ» ³ªÅ¸³»¹Ç·Î °¡Àå ¾Õ ºí·°Àº
¼öÆÛºí·°ÀÔ´Ï´Ù(¹°·Ð ¹é¾÷º»ÀÌ ÀÖ½À´Ï´Ù). ¼öÆÛºí·°ÀÇ ¹é¾÷Àº 0, 32,
... ½ÄÀ¸·Î Áõ°¡ÇÕ´Ï´Ù. ¿ø¸®´Â µð½ºÅ©¸¦ Á× ÈÈÀ¸¸é¼ ¼öÆÛºí·°À»
ãÀºÈÄ(FS_MAGICÀ¸·Î º¸´Ï±î »ç½Ç ¿©·¯ ¼½Å͵éÀÌ °É¸®°ÚÁÒ. ±×°Ô
¼öÆÛºí·°ÀÎÁö ¾Æ´ÑÁö´Â Àß ¸ð¸£´Ï±î...), ÀÎÁ¢ÇÑ µÎ ¼öÆÛºí·°ÀÇ ¼½ÅÍ
Â÷À̰¡ 32¼½ÅͰ¡ µÇ´Â °÷À» ã¾Æ³½ ÈÄ À̰ÍÀ» ·¹À̺íÀÇ
½ÃÀÛÁ¡À¸·Î(½ÇÁ¦·Î´Â A¿Í B°¡ 32¼½ÅÍ Â÷À̳ª´Â µÎ ºí·°À̶ó ÇÒ ¶§, A¿¡¼
16ºí·°À» »« °ªÀÌ ÇÑ ·¹À̺íÀÇ ½ÃÀÛÀÔ´Ï´Ù) ÀÎÁ¤ÇÏ´Â °Ì´Ï´Ù. ÀÌ·± ½ÄÀ¸·Î
ÇØ¼ ´Ù ãÀ¸¸é ±× Á¤º¸¸¦ ¹ÙÅÁÀ¸·Î disklabel¸í·ÉÀ¸·Î ·¹ÀÌºí¸¸ º¹±¸Çϸé
ÆÄÀϽýºÅÛÀº ´Ù½Ã ¸¶¿îÆ®ÇÒ ¼ö ÀÖ½À´Ï´Ù.
¸ÞÀϸµ ¸®½ºÆ® ¾ÆÄ«À̺꿡¼ À̶§ »ç¿ëµÇ´Â ÇÁ·Î±×·¥À» ãÀ» ¼ö ÀÖ½À´Ï´Ù.
disklabel recovery ½ÄÀ¸·Î °Ë»ö¾î¸¦ ÁÖ¾ú´ø °Í °°Àºµ¥ Áö±ÝÀº °Ë»öÀÌ
¾ÈµÇ´Â±º¿ä. :< ´ë½Å ¿©±â ºÙÀÔ´Ï´Ù. ¾Æ·¡ ÇÁ·Î±×·¥À¸·Î µð½ºÅ©·¹À̺íÀÇ
½ÃÀÛ À§Ä¡¸¦ ¾Ë°í, ffsrecover·Î ¼öÆÛºí·° Á¤º¸¸¦ ºÁ¼ Å©±â¸¦
¾Ë¾Æ³»°í(±× ÇÁ·Î±×·¥ÀÇ °á°ú´Â 1k ´ÜÀ§À̹ǷΠµð½ºÅ©·¹ÀÌºí¿¡ ¾²·Á¸é 2¸¦
°öÇØ¾ß ÇÕ´Ï´Ù) ½ÃÀÛ À§Ä¡¸¦ ¾Ë¾Æ³»¸é ¾î·ÆÁö ¾Ê°Ô µð½ºÅ©·¹À̺íÀ» º¹±¸ÇÒ
¼ö ÀÖ½À´Ï´Ù. ¾î¶² ·¹À̺íÀÌ(a,b,d,e,f,g,h) ±× ¼½ÅÍ ¹üÀ§¿¡ ÇØ´çÇÏ´ÂÁö´Â
cat /dev/wd0s2 | strings | more
ÇÏ¸é µð½ºÅ© ³»¿ëÀÌ ´ýÇÁµÇ´Âµ¥ ´ë·« ¾ÕºÎºÐ¿¡ /etc/fstabÀÇ ³»¿ëÀÌ
³ª¿À´Â °æ¿ì°¡ ÀÖ½À´Ï´Ù. ÀÌ°É º¸¸é Á¤È®È÷ »ì¸± ¼ö ÀÖ°í, / °¡ ¾Æ´Ñ
ÆÄƼ¼ÇÀ̶ó¸é Àû´çÈ÷ ÇÏ¸é µÇ°ÚÁÒ. ¾îÂ÷ÇÇ disklabelÀº ¼ø¼¸¦ µûÁöÁö
¾Ê½À´Ï´Ù.
Ȥ ³ªÁß¿¡ Àú°°Àº »ç°í ´çÇϽŠºÐÀ» À§ÇØ Àû¾îµÓ´Ï´Ù.
Navigation Bar
Date: Sun, 25 Dec 1994 20:10:38 -0500 (EST)
From: Peter Dufault <dufault@hda.com>
To: alan@math.ucsb.edu (Alan D. Trombla)
Cc: questions@freebsd.org
Subject: Re: HELP!! Boot block/disklabel wiped
Message-ID: <199412260110.UAA03355@hda.com>
In-Reply-To: <19941225173505.AAA6921@emile.math.ucsb.edu> from "Alan
D. Trombla" at Dec 25, 94 09:35:05 am
-------------------------------------------------------------------------------
Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
-------------------------------------------------------------------------------
Alan D. Trombla writes:
>
(...)
> How can I reconstruct a disklabel? Is the disklabel/partition info
> stashed in some other well-known location on disk? Do superblocks
> know about there own partition? Other partitions? How can I locate a
> superblock --- do they have some kind of magic cookie that I could
> scan for?
Here is a program that might help you. I wrote it when I accidentally
trashed my disk label on a two partition drive and couldn't bear the
thought of hours of spinning tapes to get it back. Two lessons - be
careful when labeling disks and print out your labels (or at least store
them on other drives).
As long as your label is fairly simple you should be able to find the
partitions. Look for "hits" 16 blocks apart. Here is the label
on one of my drives:
> 8 partitions:
> # size offset fstype [fsize bsize cpg]
> a: 65536 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 31)
> b: 65536 65536 swap # (Cyl. 32 - 63)
> c: 586764 0 unused 0 0 # (Cyl. 0 - 286)
> d: 586764 0 unused 0 0 # (Cyl. 0 - 286)
> e: 455692 131072 4.2BSD 1024 8192 16 # (Cyl. 64 - 286)
And here is some of the output from findfs. This is around the two
partitions starting at 0 and 131072.
Each "hit" is a superblock:
> hda.com# ./findfs /dev/rsd0c 0 100
> Checked block 0
> !!! Hit at 16 !!!
> 16
> !!! Hit at 32 !!!
> 32
> hda.com# ./findfs /dev/rsd0c 131000 132000
> Checked block 131072
> !!! Hit at 131088 !!!
> 131088
> !!! Hit at 131104 !!!
> 131104
> hda.com#
Note that the first superblock "hit" will be 16 blocks beyond the
start of the partition and there will always be an alternate
superblock (another hit) 16 later. That is a good signature for
the start of a partition. This only works for 512 byte sectors.
++++Start of findfs.c:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#include <ufs/ffs/fs.h>
#include <errno.h>
char buff[8192];
int check(int fid, int block)
{
struct fs *fs;
if (lseek(fid, (off_t)block * 512, SEEK_SET) == -1)
{
perror("lseek");
exit(-1);
}
if (read(fid, buff, sizeof(buff)) != sizeof(buff))
{
perror("read");
exit(-1);
}
fs = (struct fs *)buff;
if (fs->fs_magic == FS_MAGIC)
{
fprintf(stderr, "!!! Hit at %d !!!\n", block);
printf("%d\n", block);
fflush(stdout);
return 1;
}
return 0;
}
main(int argc, char *argv[])
{
FILE *f;
int block, start, end;
int fid;
if (argc != 4)
{
fprintf(stderr, "usage: %s device start_block end_block.\n",
argv[0]);
exit(-1);
}
f = fopen(argv[1], "r");
if (f == 0)
{
perror(argv[1]);
exit(errno);
}
sscanf(argv[2], "%d", &start);
sscanf(argv[3], "%d", &end);
fid = fileno(f);
for (block = start; block <= end;block++)
{
check(fid, block);
if ((block % 4096) == 0)
fprintf(stderr, "Checked block %d\n", block);
}
}
----End of findfs.c.
Peter
--
Peter Dufault Real Time Machine Control and Simulation
HD Associates, Inc. Voice: 508 433 6936
dufault@hda.com Fax: 508 433 5267
++++ New e-mail address. E-mail problems? Tell hdslip@iii.net
-------------------------------------------------------------------------------
www@FreeBSD.org
--
+++ Any opinions in this posting are my own and not those of my employers +++
CHOI Junho <cjh@FreeBSD.org> <cjh@kr.FreeBSD.org>
KFUG <http://www.kr.FreeBSD.org> Web Data Bank <http://www.wdb.co.kr>
FreeBSD, GNU/Linux Developer http://people.FreeBSD.org/~cjh
--
To Unsubscribe: send mail to majordomo@kr.FreeBSD.org
with "unsubscribe hackers" in the BODY of the message
|
Copyright © 1998-2003 Korea FreeBSD Users Group. All rights reserved. webmaster at kr.FreeBSD.org $Date: 2002/03/26 13:22:37 $ |
|