Koozali.org: home of the SME Server

Emergency... Formatted harddrive???

Offline tropicalview

  • *****
  • 196
  • +0/-0
    • http://www.tropicalview.net
Emergency... Formatted harddrive???
« on: July 18, 2008, 04:39:35 AM »
Dear all,

I was busy with a USb harddrive.
and i did create a partition on it and formatted it.

the commands i used where:

fdisk /dev/sda2
mkfs.ext3 -L backup01 /dev/sda2


I'm 99.9% sure that i have the right disk because:
1 the size of the disk match
2 there where not partitions on it when i started.

but.....
after i have done that the system only gives me this:

-bash: /usr/bin/dir: Input/output error

when i try to connect with vpn to the machine he doesn't answer... what did i wrong?
did i format my main disk ????


I hope someone will help me urgently.... because i do not know what to do! can i restart the machine, did I lost any data?

Kind regards,

ps see a list of the last screen:

Code: [Select]
login as: root
root@abeltasmancur.com's password:
Last login: Thu Jul 17 13:53:25 2008 from pc-00196.admin.abeltasmancur.com
[root@admin-svr ~]# fdisk /dev/sdb1

Unable to open /dev/sdb1
[root@admin-svr ~]# cd /dev
[root@admin-svr dev]# dir
arpd           md0    null      sda2     tty18  tty50   ttyS25  ttyS58
cdrom          md1    par0      sdb      tty19  tty51   ttyS26  ttyS59
cdwriter       md10   parport0  shm      tty2   tty52   ttyS27  ttyS6
console        md11   parport1  skip     tty20  tty53   ttyS28  ttyS60
core           md12   parport2  stderr   tty21  tty54   ttyS29  ttyS61
cpu            md13   parport3  stdin    tty22  tty55   ttyS3   ttyS62
device-mapper  md14   port      stdout   tty23  tty56   ttyS30  ttyS63
disk           md15   ppp       systty   tty24  tty57   ttyS31  ttyS64
dm-0           md16   ptmx      tap0     tty25  tty58   ttyS32  ttyS65
dm-1           md17   pts       tap1     tty26  tty59   ttyS33  ttyS66
dnrtmsg        md18   ram       tap10    tty27  tty6    ttyS34  ttyS67
dvd            md19   ram0      tap11    tty28  tty60   ttyS35  ttyS7
fd             md2    ram1      tap12    tty29  tty61   ttyS36  ttyS8
full           md20   ram10     tap13    tty3   tty62   ttyS37  ttyS9
fwmonitor      md21   ram11     tap14    tty30  tty63   ttyS38  urandom
hda            md22   ram12     tap15    tty31  tty7    ttyS39  usb
initctl        md23   ram13     tap2     tty32  tty8    ttyS4   usersock
input          md24   ram14     tap3     tty33  tty9    ttyS40  vcs
ip6_fw         md25   ram15     tap4     tty34  ttyS0   ttyS41  vcs1
kmsg           md26   ram2      tap5     tty35  ttyS1   ttyS42  vcs2
log            md27   ram3      tap6     tty36  ttyS10  ttyS43  vcs3
loop0          md28   ram4      tap7     tty37  ttyS11  ttyS44  vcsa
loop1          md29   ram5      tap8     tty38  ttyS12  ttyS45  vcsa1
loop2          md3    ram6      tap9     tty39  ttyS13  ttyS46  vcsa2
loop3          md30   ram7      tcpdiag  tty4   ttyS14  ttyS47  vcsa3
loop4          md31   ram8      tty      tty40  ttyS15  ttyS48  vmmon
loop5          md4    ram9      tty0     tty41  ttyS16  ttyS49  vmnet0
loop6          md5    ramdisk   tty1     tty42  ttyS17  ttyS5   xfrm
loop7          md6    random    tty10    tty43  ttyS18  ttyS50  XOR
lp0            md7    rawctl    tty11    tty44  ttyS19  ttyS51  zero
lp1            md8    root      tty12    tty45  ttyS2   ttyS52
lp2            md9    route     tty13    tty46  ttyS20  ttyS53
lp3            mem    route6    tty14    tty47  ttyS21  ttyS54
main           mice   rtc       tty15    tty48  ttyS22  ttyS55
MAKEDEV        net    sda       tty16    tty49  ttyS23  ttyS56
mapper         nflog  sda1      tty17    tty5   ttyS24  ttyS57
[root@admin-svr dev]# fdisk /dev/sda2
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 17737.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sda2: 145.8 GB, 145891791360 bytes
255 heads, 63 sectors/track, 17737 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

     Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
1
Invalid partition number for type `1'
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-17737, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-17737, default 17737):
Using default value 17737

Command (m for help):
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@admin-svr dev]# mkfs.ext3 -L MyLabel /dev/sdc1
mke2fs 1.35 (28-Feb-2004)
Could not stat /dev/sdc1 --- No such file or directory

The device apparently does not exist; did you specify it correctly?
[root@admin-svr dev]# mkfs.ext3 -L backup01 /dev/sda2
mke2fs 1.35 (28-Feb-2004)
Filesystem label=backup01
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
17809408 inodes, 35618113 blocks
1780905 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=37748736
1087 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Creating journal (8192 blocks): mkfs.ext3: Input/output error
        while trying to create journal
[root@admin-svr dev]# mount
-bash: mount: command not found
[root@admin-svr dev]# mount
-bash: mount: command not found
[root@admin-svr dev]# cd /media
-bash: cd: /media: Input/output error
[root@admin-svr dev]# dir
-bash: /usr/bin/dir: Input/output error
[root@admin-svr dev]# cd /media
-bash: cd: /media: Input/output error
[root@admin-svr dev]# dir
-bash: /usr/bin/dir: Input/output error

The sky is not the limit, But when I reach the sky, for sure I will not try to go to the limit.... (donated $25,- upto now)

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Emergency... Formatted harddrive???
« Reply #1 on: July 18, 2008, 05:21:12 AM »
[root@admin-svr ~]# fdisk /dev/sdb1

Unable to open /dev/sdb1
[root@admin-svr ~]#

Here you are trying to partition a partition. fdisk should only be used with a complete disk, e.g. "fdisk /dev/sdb".

My guess is that you will need to recover from backup. And you should be more careful next time.

Offline tropicalview

  • *****
  • 196
  • +0/-0
    • http://www.tropicalview.net
Re: Emergency... Formatted harddrive???
« Reply #2 on: July 18, 2008, 05:26:59 AM »
Hi CharlieBrady,

First of all thank you for your very quick answer.

this first command was done to an old partition on the usb disk (the one i wanted to format)

that one doesn't exist anymore later i did the same to /dev/sda2

is /dev/sda2 also a partition??
could that be the primary partition with all the data?

is there any way of getting this data back? the thing i was doing was preparing for the first data backup ever.
so we do not have a good databackup.
The sky is not the limit, But when I reach the sky, for sure I will not try to go to the limit.... (donated $25,- upto now)

Offline tropicalview

  • *****
  • 196
  • +0/-0
    • http://www.tropicalview.net
Re: Emergency... Formatted harddrive???
« Reply #3 on: July 18, 2008, 05:37:29 AM »
Indeed, i have about the same server running.
that one does have the same hardware and indeed the main harddrive is sda

so the main partition was sda2 (and i formatted that one)

is there any way to recover that?

Please, this is realy important
The sky is not the limit, But when I reach the sky, for sure I will not try to go to the limit.... (donated $25,- upto now)

Offline okepc

  • ****
  • 118
  • +0/-0
    • http://www.okepc.nl
Re: Emergency... Formatted harddrive???
« Reply #4 on: July 18, 2008, 11:33:31 AM »
You could try to use testdisk to recover.

http://www.cgsecurity.org/wiki/TestDisk

Dirk

Offline zatnikatel

  • *****
  • 190
  • +0/-0
Re: Emergency... Formatted harddrive???
« Reply #5 on: July 18, 2008, 07:00:31 PM »
EXT3 can be a pain to recover because you formated the disk it could be a large problem ext2 was much easer but ext3 much more of a pain
have fun but recover files from an ext3 file system is not an easy or impossiable habe done a lot of research on this

Offline tropicalview

  • *****
  • 196
  • +0/-0
    • http://www.tropicalview.net
Re: Emergency... Formatted harddrive???
« Reply #6 on: July 18, 2008, 07:59:26 PM »
What is the standard file system used by SME server? EXT3 or EXT2????


The sky is not the limit, But when I reach the sky, for sure I will not try to go to the limit.... (donated $25,- upto now)

Offline mercyh

  • *
  • 824
  • +0/-0
    • http://mercyh.org
Re: Emergency... Formatted harddrive???
« Reply #7 on: July 18, 2008, 08:07:57 PM »
EXT3