On Fri, 10 Apr 2015 12:00:06 -0500 Chris Bennett 
<[email protected]> wrote:
> I have been copying home folders from several disks that should be near
> failing due to age to an external USB disk.
> 
> I have been using:
> cd /SRC; tar cf -  . | (cd /DST; tar xpf - )
> 
> Works fine, except I overlooked mounting /DST on first try, so
> everything ended up in / until full. I also started deleting those files
> until I realized I was in /SRC and Ctrl C it.
> Now I have a problem, I have
> /dev/sd0a     1005M   1005M  -50.1M   105%   /

that is not unusual. the filesystem sets aside space that is unusable except
by root, and not normally counted.

> 
> I cannot find those files (would really like to have them).
> I have tried fsck -fp, fsck and tried to upgrade it back. Upgrade gives
> same file system full problem.

what were you upgrading, openbsd? that has nothing to do with this problem.
the files should be in /DST, unless it didn't exist, and then they should be
in the invoking directory ie /SRC. you may still have the files you deleted
from /SRC in /DST, but that entails a bit of luck ie if 'tar' copied in the
same order that 'rm' deleted, they may be there (in /DST).

you may need some space (but not much) to do this, but you can use 'find' to
compare the contents of the directories, ie

$ cd /SRC; find . | sort >../SRC.list
$ cd /DST; find . | sort >../DST.list
$ cd /
$ comm -12 SRC.list DST.list

the above 'comm -12' will give you a list of files that are common to both
/SRC and /DST (thus duplicates). you may want to delete these after some
checking, as such:

OLDIFS="$IFS"
IFS='\n'
for _file in $(comm -12);do
  if [[ "$(cksum -q SRC/"$_file")" = "$(cksum -q DST/"$_file")" ]];then
    rm -f DST/"$_file"
  else
    echo "checksum mismatch for $_file"
  fi
done
IFS="$OLDIFS"

this way you delete the files in /DST after ensuring that the identical
version exists in /SRC. if there is a mismatch, probably the /DST version
is corrupted (incomplete). check sizes and delete manually. the IFS stuff
is to ensure filenames with spaces don't you give you problems.

next:

$ comm -13 SRC.list DST.list

the 'comm -13' command above should give you a listing of files in /DST that
are not in /SRC, which you could copy back to /SRC in case you deleted them.

if however you deleted the file in /SRC, and it was not backed up in /DST,
i'm pretty sure you are out of luck. but it seems if you still have that
much space used, you probably didn't lose much (and like i said about the
order of tar and rm above...).

at the end of this, /DST should be clear, and you could start again (after
mounting!).


also, for future reference use '&&'. it may catch some rare problems (in
this case if the directory did not exist).

$ cd /SRC && tar cf -  . | (cd /DST && tar xpf - )

> 
> I can go to install, but I would like to know if there is another fix.
> 
> I would even more like to know what has happened in the file system.
> So that information is more important to me than a fix.
> 
> Thanks,
> Chris Bennett
> 

good luck

Reply via email to