OT: oprava partisny

Jan Kokoska kokoska.jan na globe.cz
Čtvrtek Leden 15 11:32:00 CET 2004


On Tue, 2004-01-13 at 15:52, Honza Houstek wrote:
> On Tue, 13 Jan 2004, Jan Kokoska wrote:
> 
> > umm, ze by fsck.vfat? ;) a ma i zajimavou manualovou stranku...
> 
> Ona opravdu existuje nejaka linuxova verze FAT scandisku? Kde? Ja jsem
> pred casem delal takovy soukromy pruzkum robustnosti jednotlivych
> fsck-like utilit pro ruzne fs (testovaci metoda byla asi takova, ze jsem
> na konzistentnim filesystemu zmenil nahodne vetsi mnozstvi dat a pak jsem
> na to tu utilitu pustil (*)).
> 

Pouzivam Debian unstable a binarka patri do tohoto balicku:
ii  dosfstools     2.10-1
	Utilities to create and check MS-DOS FAT filesystems

fsck.vfat je link an dosfsck.

Dosud jsem to nikdy nepouzil (vfat nepatri k mym oblibenym fs), takze
jsem provedl trivialni test:

mount -t tmpfs -o size=1M tmpfs /mnt/tmp
dd if=/dev/zero of=/mnt/tmp/fs bs=1M count=1 conv=sync
mount -t vfat -o loop /mnt/tmp/fs /mnt/vfat
#cp soubory* /mnt/vfat
umount /mnt/vfat

for i in $(seq 1 10); do dd if=/dev/random of=/mnt/tmp/fs bs=512 count=1
	seek=$(($RANDOM / 50)); done;

mount -t vfat -o loop /mnt/tmp/fs /mnt/vfat

ls /mnt/vfat :

-rwxr--r--    1 root     root     1786055287 Jun  8  2016 ???x????.?g?
-rwxr--r--    1 root     root         9874 Jan 15 10:46 char_dev.c
-rwxr--r--    1 root     root         8931 Jan 15 10:46 char_dev.o
-rwxr--r--    1 root     root        16282 Jan 15 10:46 compat.c
-rwxr--r--    1 root     root        92324 Jan 15 10:46 compat_ioctl.c
...

zrejme se podarilo strefit primo FAT, coz je fajn pri "sofistikovanosti"
pouzite metody.

umount /mnt/vfat
vfat.fsck /mnt/tmp/fs

> dosfsck 2.10, 22 Sep 2003, FAT32, LFN
> /ßÖnotx_o\237O.aGu
>   Bad file name.
> 1) Drop file
> 2) Rename file
> 3) Auto-rename
> 4) Keep it

> ? 1

> /aÖnotx_o\237O.aGu
>   Start cluster beyond limit (62735 > 499). Truncating file.
> /aÖnotx_o\237O.aGu
>   File size is 1786055287 bytes, cluster chain length is 0 bytes.
>   Truncating file to 0 bytes.
> /\236 /\204]éyy.ú×\221
>   Start cluster beyond limit (11593 > 499). Truncating file.
> /\236 /\204]éyy.ú×\221
>   File size is 2759532985 bytes, cluster chain length is 0 bytes.
>   Truncating file to 0 bytes.
> Leaving file system unchanged.
> /mnt/fs: 67 files, 498/498 clusters

okej, takze jinak...

> fsck.vfat -Vv /mnt/fs
> dosfsck 2.10 (22 Sep 2003)
> dosfsck 2.10, 22 Sep 2003, FAT32, LFN
> Checking we can access the last sector of the filesystem
> Boot sector contents:
> System ID "mkdosfs"
> Media byte 0xf8 (hard disk)
>        512 bytes per logical sector
>       2048 bytes per cluster
>          1 reserved sector
> First FAT starts at byte 512 (sector 1)
>          2 FATs, 12 bit entries
>       1024 bytes per FAT (= 2 sectors)
> Root directory starts at byte 2560 (sector 5)
>        512 root directory entries
> Data area starts at byte 18944 (sector 37)
>        498 data clusters (1019904 bytes)
> 32 sectors/track, 64 heads
>          0 hidden sectors
>       2032 sectors total
> Starting check/repair pass.
> /\236 /\204]éyy.ú×\221
>   Start cluster beyond limit (11593 > 499). Truncating file.
> /\236 /\204]éyy.ú×\221
>   File size is 2759532985 bytes, cluster chain length is 0 bytes.
>   Truncating file to 0 bytes.
> Checking for unused clusters.
> Starting verification pass.
> Checking for unused clusters.
> Leaving file system unchanged.
> /mnt/fs: 134 files, 498/498 clusters
> marigold:/# fsck.vfat /mnt/fs
> dosfsck 2.10, 22 Sep 2003, FAT32, LFN
> /\236 /\204]éyy.ú×\221
>   Start cluster beyond limit (11593 > 499). Truncating file.
> /\236 /\204]éyy.ú×\221
>   File size is 2759532985 bytes, cluster chain length is 0 bytes.
>   Truncating file to 0 bytes.
> Leaving file system unchanged.
> /mnt/fs: 67 files, 498/498 clusters


> echo $?
> 1

>        1      Recoverable errors have been detected or dosfsck has discovered an internal  incon-
>               sistency.

to je fajn, ale:

>       -V     Perform a verification pass. The file system check is repeated after the first run.
>               The  second  pass  should never report any fixable errors. It may take considerably
>               longer than the first pass, because the first pass may have generated long list  of
>               modifications that have to be scanned for each disk read.

pokus o zahozeni souboru se nezdaril, po mountu tam porad je, lze smazat
rucne.. rozbouranu tabulku se nedari opravit, zacatek clusteru porad
mimo filesystem, fs lze "samozrejme" dal mountovat a pouzivat, pokud
netrvam na konzistenci souboru ;) zacina mi to pripominat cernobile
ruske televize, ktere slo opravovat dobre mirenym uderem pesti...

z stracu a ltracu jsem se podle ocekavani nic nedozvedel, po ctvrthodine
testovani tak nemam pocit, ze neznalosti tehle utility uzivatele o neco
prichazeji... ovsem pokud uz musite pracovat s vfat, treba budete mit
vice stesti.

-- 
Jan Kokoska




Další informace o konferenci Linux