Sponsored Content
Operating Systems Linux C++ Code to Access Linux Hard Disk Sectors (with a LoopBack Virtual Hard Disk) Post 302491431 by Corona688 on Thursday 27th of January 2011 12:13:11 PM
Old 01-27-2011
Yes, that's what I mean, you have to understand how ext3 works to mess with it raw. With the bits of it you've overwritten now, it probably needs a reformat to be valid ext3 again.

Do you need to use ext3? If not, I'd reformat it with /sbin/fsck.msdos -F 16 filename /sbin/mkfs.msdos -F 16 filename as the MSDOS filesystem is far, far simpler: just a big table, instead of a tree.

You might find the hexdump utility handy to show you what data you should expect to find in what places. Here's part of a hex dump of a flash drive I had lying around:

Code:
$ hexdump -C 8gflash-2011-01-27.vfat | head
00000000  eb 58 90 29 5e 76 56 4b  49 48 43 00 02 08 90 08  |.X.)^vVKIHC.....|
00000010  02 00 00 00 00 f8 00 00  20 00 10 00 80 1f 00 00  |........ .......|
00000020  80 40 ef 00 b8 3b 00 00  00 00 00 00 02 00 00 00  |.@...;..........|
00000030  01 00 08 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000040  00 00 29 53 6a af d5 20  20 20 20 20 20 20 20 20  |..)Sj..         |
00000050  20 20 46 41 54 33 32 20  20 20 fa 33 c9 8e d1 bc  |  FAT32   .3....|
00000060  f8 7b 8e c1 bd 78 00 c5  76 00 1e 56 16 55 bf 22  |.{...x..v..V.U."|
00000070  05 89 7e 00 89 4e 02 b1  0b fc f3 a4 8e d9 bd 00  |..~..N..........|
00000080  7c c6 45 fe 0f 8b 46 18  88 45 f9 38 4e 40 7d 25  ||.E...F..E.8N@}%|
00000090  8b c1 99 bb 00 07 e8 97  00 72 1a 83 eb 3a 66 a1  |.........r...:f.|

If you want to use a proper Linux filesystem, try ext2 instead of ext3, it's pretty much the same as ext3 but with a lot of journalling fluff cut out.

These links are good starting points on FAT and ext2.

Last edited by Corona688; 01-27-2011 at 01:30 PM.. Reason: collosal thinko
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

hard disk problems

Hi all I am facing a strange problem. I am using a sun ultra10 spark machine. first i took a 20gb IDE hard disk and installed solaris 5.8. But due to some requirement i have to reinstall the OS but this time solaris 2.6. and now the hard disk capacity is only showing 8gb. Where the 12gb... (3 Replies)
Discussion started by: Prafulla
3 Replies

2. Filesystems, Disks and Memory

hard disk meltdown

I had an issue with a second hard disk in my machine. I have a sparc station running solaris 7. It was working fine but now it wont mount on boot up and when you try to mount it manually it gives an I/O error. I tried a different disk as a control which was fine. What I want to know is if my... (3 Replies)
Discussion started by: Henrik
3 Replies

3. Filesystems, Disks and Memory

Adding hard Disk

Hi all, I am using SCO Openserver V and I want to add one more harddisk (/dev/hd1) Hw can I do it? (1 Reply)
Discussion started by: skant
1 Replies

4. UNIX Desktop Questions & Answers

Hard Disk

I have a cuestion. How Can I to add other hard disk to my computer? I need to configurate anyone? (4 Replies)
Discussion started by: hmaraver
4 Replies

5. UNIX for Dummies Questions & Answers

Hard Disk Check

How can we check the number of hard disks (both internal & external) in a server, their capacity and serial number (5 Replies)
Discussion started by: muneebr
5 Replies

6. UNIX for Dummies Questions & Answers

Hard Disk at 99% Help!

:eek: I use this Solaris to run CMS a call acounting software package for my job. No one could run reports today because it said the this when you logged on "The following file systems are low, and could adversely affect server performance: File system /: 99%full" Can some one please explain... (9 Replies)
Discussion started by: mannyisme
9 Replies

7. UNIX for Dummies Questions & Answers

How to increase hard disk in linux

Hi guys i have created a linux machine in virtual box now i want to add some hard disk space into it. How would i do this. Please help. Machine details are as below # lsb_release -a LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID:... (7 Replies)
Discussion started by: pinga123
7 Replies

8. SCO

declare disk driver for IDE hard disk

hi I've a fresh installation of SCO 5.0.7 on the IDE hard disk. For SCSI hard disk I can declare, for example blc disk driver using: # mkdev hd 0 SCSI-0 0 blc 0but it works for IDE hard disk? (3 Replies)
Discussion started by: ccc
3 Replies

9. Red Hat

Need help for getting hard-disk traces

When we write a programme,we declare variables and compiler allocates memory to them.I want to get access to the physical block number of hard-disk where actually the data is stored by the programme " Some one help me out... (1 Reply)
Discussion started by: nagraz007
1 Replies

10. UNIX for Advanced & Expert Users

Need help for getting hard-disk traces

When we write a programme,we declare variables and compiler allocates memory to them.I want to get access to the physical block number of hard-disk where actually the data is stored by the programme " Some one help me out... (3 Replies)
Discussion started by: nagraz007
3 Replies
MKFS(8) 						      System Manager's Manual							   MKFS(8)

NAME
mkfs - build a Linux file system SYNOPSIS
mkfs [ -V ] [ -t fstype ] [ fs-options ] filesys [ blocks ] DESCRIPTION
mkfs is used to build a Linux file system on a device, usually a hard disk partition. filesys is either the device name (e.g. /dev/hda1, /dev/sdb2) or the mount point (e.g. /, /usr, /home) for the file system. blocks is the number of blocks to be used for the file system. The exit code returned by mkfs is 0 on success and 1 on failure. In actuality, mkfs is simply a front-end for the various file system builders (mkfs.fstype) available under Linux. The file system-spe- cific builder is searched for in a number of directories like perhaps /sbin, /sbin/fs, /sbin/fs.d, /etc/fs, /etc (the precise list is defined at compile time but at least contains /sbin and /sbin/fs), and finally in the directories listed in the PATH enviroment variable. Please see the file system-specific builder manual pages for further details. OPTIONS
-V Produce verbose output, including all file system-specific commands that are executed. Specifying this option more than once inhibits execution of any file system-specific commands. This is really only useful for testing. -t fstype Specifies the type of file system to be built. If not specified, the default file system type (currently ext2) is used. fs-options File system-specific options to be passed to the real file system builder. Although not guaranteed, the following options are sup- ported by most file system builders. -c Check the device for bad blocks before building the file system. -l filename Read the bad blocks list from filename -v Produce verbose output. BUGS
All generic options must precede and not be combined with file system-specific options. Some file system-specific programs do not support the -v (verbose) option, nor return meaningful exit codes. Also, some file system-specific programs do not automatically detect the device size and require the blocks parameter to be specified. AUTHORS
David Engel (david@ods.com) Fred N. van Kempen (waltje@uwalt.nl.mugnet.org) Ron Sommeling (sommel@sci.kun.nl) The manual page was shamelessly adapted from Remy Card's version for the ext2 file system. SEE ALSO
fs(5), badblocks(8), fsck(8), mkdosfs(8), mke2fs(8), mkfs.bfs(8), mkfs.ext2(8), mkfs.ext3(8), mkfs.minix(8), mkfs.msdos(8), mkfs.vfat(8), mkfs.xfs(8), mkfs.xiafs(8) Version 1.9 Jun 1995 MKFS(8)
All times are GMT -4. The time now is 07:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy