[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mdadm drive fail power cord issue.



Muhammad Yousuf Khan wrote:
> > > root@nasbox:~# sfdisk -d /dev/sdc
> > > read: Input/output error
> >
> > That looks scary to me.  You have an active partition on /dev/sdc1 but
> > here /dev/sdc reported an I/O error?  That seems very bad.  At this
> > point I would stop and look carefully at the drive.  I would look at
> > the SMART selftests from the drive.  Here are some useful commands.
> >
> > as i said i messed up the first partition :( and loss all the data.

But the above is a read error.  That is an indication of a drive
failure.  Messing up a partition would not create a drive failure.  It
would only cause a partitioning problem.  The above scares me into
thinking that the drive is failing.

> > # smartctl -i /dev/sdc                                          smartctl
> > 5.43 2012-05-01 r3539 [i686-linux-2.6.32-5-686] (local build)
> > Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
> >
> > Vendor:               /3:0:0:0
> > Product:
> > User Capacity:        600,332,565,813,390,450 bytes [600 PB]
> > Logical block size:   774843950 bytes
> > scsiModePageOffset: response length too short, resp_len=47 offset=50
> > bd_len=46
> > >> Terminate command early due to bad response to IEC mode page
> > A mandatory SMART command failed: exiting. To continue, add one or more
> > '-T permissive' options.

And that looks bad too.  Looks like that drive is failing!

> root@nasbox:/dev# smartctl -l error /dev/sdc
> > smartctl 5.43 2012-05-01 r3539 [i686-linux-2.6.32-5-686] (local build)
> > Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
> >
> > Short INQUIRY response, skip product id
> > A mandatory SMART command failed: exiting. To continue, add one or more
> > '-T permissive' options.

Looks bad for that drive.  I think you will need to assume that it is
failed and abandon it.

> i got your point and to decrease my paint of using GPT i have just
> baught 1.5 TB harddrives.  so i am creating another storage
> server. i have the backup and restoring all the data to new
> fileserver

With this data that should be an easy way to recover successfully.  Or
at least easier.  If that is affordable for you then all is good.

> but the problem part is samba :( actually all users UID and GID would be
> lost and i have to reassign
> all the rights once again to all the folders that a paint.
> 
> do you or any one know, how can i map samba MAP correct UID and GID to new
> users as the old users were using in my old Samba box.
> 
> i know there are some command line games but assigning individually a UID
> or GID via command would be hell of a tough job.

Sorry but the above is hard for me to understand.  Are you asking how
you can transfer users from /etc/passwd on one machine to another
machine?  If that is your question then I would copy those users to
the new machine's /etc/passwd file.  Copy the user account lines (user
accounts have uid's and gid's >=1000) from these files:

  /etc/passwd
  /etc/group
  /etc/shadow
  /etc/gshadow

Append the user account lines from those files onto the end of the new
machine's files.  That is all that is needed.

These commands may be useful for extracting the user account lines
from these files.

  awk -F: '$3>=1000' /etc/passwd

  awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd

  for i in $(awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd); do grep "^$i:" /etc/group; done

  for i in $(awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd); do grep "^$i:" /etc/shadow; done

  for i in $(awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd); do grep "^$i:" /etc/gshadow; done

Look this over, understand what they are doing, then append the
results onto the new files on the new system and the old users will
have been transferred to the new system.

  awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd > /root/passwd.users

  for i in $(awk -F: '$3>=1000 && $3<65534{print$1}' /etc/passwd); do grep "^$i:" /etc/group; done > /root/group.users

And so forth.  Then copy those files to the new machine.  Then append
those lines to the correct files on the new machine.

Hope that helps!
Bob

Attachment: signature.asc
Description: Digital signature


Reply to: