LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How does scaning work? (https://www.linuxquestions.org/questions/linux-newbie-8/how-does-scaning-work-737816/)

WillingToLikeLinux 07-05-2009 05:15 AM

How does scaning work?
 
This is from

http://ubuntuforums.org/showthread.php?t=1006328

I am still not familiar how the whole terminal thing goes for this. I don't know much on this.

Quote:

Directly after getting the error, check /var/log/syslog and see if there are any disk-related errors.

Also, I would scan both your USB drive and your laptop's hard drive with "badblocks -v".
How does check /var/log/syslog and badblocks -v work in the terminal step-by-step?

I don't know where to start when I am very clueless on command line; only know very basic.

repo 07-05-2009 05:22 AM

open a terminal, login as root and type
Code:

tail -f /var/log/syslog
Then if the error appears, look at the output in the terminal.
So you can follow the logfile live.

Quote:

badblocks -v work in the terminal
try man badblocks
Code:

badblocks -v /dev/hdx

WillingToLikeLinux 07-05-2009 05:29 AM

Quote:

Originally Posted by repo (Post 3597184)
try man badblocks
Code:

badblocks -v /dev/hdx

It says:

Code:

badblocks: No such file or directory while trying to determine device size

repo 07-05-2009 05:32 AM

You need to know the partition you want to scan
As root
Code:

fdsik -l
Then
Code:

badblocks -v /dev/xxxx
depending on the output from fdisk -l

WillingToLikeLinux 07-05-2009 05:36 AM

Quote:

Originally Posted by repo (Post 3597189)
You need to know the partition you want to scan
As root
Code:

fdsik -l
Then
Code:

badblocks -v /dev/xxxx
depending on the output from fdisk -l

which /dev/??? entry correspond to USB drive? sda1?

Edit: Wait, I got it. fdisk

repo 07-05-2009 05:41 AM

In a terminal type
Code:

tail -f /var/log/syslog
Then plugin the usb, and look at the output.
It should read something like:
Quote:

Jul 5 12:37:47 cannabis kernel: [40399.425843] scsi 6:0:0:0: Direct-Access Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 0 CCS
Jul 5 12:37:49 cannabis kernel: [40401.392915] sd 6:0:0:0: [sdc] 7936000 512-byte hardware sectors (4063 MB)
Jul 5 12:37:49 cannabis kernel: [40401.393298] sd 6:0:0:0: [sdc] Write Protect is off
Jul 5 12:37:49 cannabis kernel: [40401.393298] sd 6:0:0:0: [sdc] Mode Sense: 23 00 00 00
Jul 5 12:37:49 cannabis kernel: [40401.393298] sd 6:0:0:0: [sdc] Assuming drive cache: write through
Jul 5 12:37:49 cannabis kernel: [40401.396917] sd 6:0:0:0: [sdc] 7936000 512-byte hardware sectors (4063 MB)
Jul 5 12:37:49 cannabis kernel: [40401.397338] sd 6:0:0:0: [sdc] Write Protect is off
Jul 5 12:37:49 cannabis kernel: [40401.397338] sd 6:0:0:0: [sdc] Mode Sense: 23 00 00 00
Jul 5 12:37:49 cannabis kernel: [40401.397338] sd 6:0:0:0: [sdc] Assuming drive cache: write through
So in this case the usb is on
Quote:

/dev/sdc

WillingToLikeLinux 07-05-2009 05:45 AM

Mine says:

Jul 5 06:42:13 ??? kernel: [ 4230.597654] FAT: Filesystem panic (dev sdb1)
Jul 5 06:42:13 ??? kernel: [ 4230.597658] fat_get_cluster: invalid cluster chain (i_pos 116569480)
Jul 5 06:42:13 ??? kernel: [ 4230.597667] FAT: Filesystem panic (dev sdb1)
Jul 5 06:42:13 ??? kernel: [ 4230.597670] fat_get_cluster: invalid cluster chain (i_pos 116569480)
Jul 5 06:42:13 ??? kernel: [ 4230.597677] FAT: Filesystem panic (dev sdb1)
Jul 5 06:42:13 ??? kernel: [ 4230.597682] fat_get_cluster: invalid cluster chain (i_pos 116569480)
Jul 5 06:42:13 ??? kernel: [ 4230.597689] FAT: Filesystem panic (dev sdb1)
Jul 5 06:42:13 ??? kernel: [ 4230.597693] fat_get_cluster: invalid cluster chain (i_pos 116569480)
Jul 5 06:42:13 ??? kernel: [ 4230.597701] FAT: Filesystem panic (dev sdb1)
Jul 5 06:42:13 ??? kernel: [ 4230.597705] fat_get_cluster: invalid cluster chain (i_pos 116569480)

Edit: I believe something's wrong with my computer reading FAT.

repo 07-05-2009 05:48 AM

Seems to me the usb has problems :-)

try
Code:

badblocks -v /dev/sdb1

WillingToLikeLinux 07-05-2009 05:57 AM

Quote:

Originally Posted by repo (Post 3597202)
Seems to me the usb has problems :-)

Or perhaps FAT isn't a good file system for USBs in the first place.

My USB's file system: W95 FAT32

Result from badblocks:

Code:

Checking blocks 0 to 3915203
Checking for bad blocks (read-only test): done                               
Pass completed, 0 bad blocks found.

Strange. This looks very odd. :(

repo 07-05-2009 06:00 AM

fat32 on usb is no problem.
You could try to reformat the drive, unless you need to recover the data on the usb
Can you read the usb in windows ?

WillingToLikeLinux 07-05-2009 06:02 AM

Quote:

Originally Posted by repo (Post 3597209)
fat32 on usb is no problem.
You could try to reformat the drive, unless you need to recover the data on the usb
Can you read the usb in windows ?

I can't reformat this. It's has some of my crucial academic data for my university courses.

I don't have Windows.

Is there a way to fix the corrupted FAT system in the USB drive?

repo 07-05-2009 06:05 AM

Take a look at testdisk
http://www.cgsecurity.org/wiki/Main_Page

WillingToLikeLinux 07-05-2009 06:07 AM

Quote:

Originally Posted by repo (Post 3597214)

Does this happen to also recover corrupted files as well? In case if my files are corrupted after the recovery, what should I do?

repo 07-05-2009 06:10 AM

Perhaps you should first focus on accessing the drive.

From the site:

Quote:

TestDisk can

* Fix partition table, recover deleted partition
* Recover FAT32 boot sector from its backup
* Rebuild FAT12/FAT16/FAT32 boot sector
* Fix FAT tables
* Rebuild NTFS boot sector
* Recover NTFS boot sector from its backup
* Fix MFT using MFT mirror
* Locate ext2/ext3 Backup SuperBlock
* Undelete files from FAT, NTFS and ext2 filesystem
* Copy files from deleted FAT, NTFS and ext2/ext3 partitions.

WillingToLikeLinux 07-05-2009 06:12 AM

Sorry about that. I'm just paranoid of the fear that I will lose my crucial files related to my university.


All times are GMT -5. The time now is 10:37 PM.