NAS 542 raid 5 volume down

245

All Replies

  • Mijzelf
    Mijzelf Posts: 2,790  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    Can I run ddrescue with the disks mounted in the NAS? (Replacing disk 1 with the new one and then run ddrescue from SSH?)

    Yes, provided you have a compatible ddrescue. I'll look if I can build one for you. And I would remove the 2 other disks as well. Less error prone. Ddrescue is a lowlevel tool, which will happily overwrite *anything* you specify as target. Without asking. So the lesser possible targets, the better.

    Be prepared that running of ddrescue can take days, if the source disk is in a bad shape. Ddrescue will go deep to try to read unreadable sectors. In theory the ssh shell should stay open all that time. But I think I can give you a compatible version of screen, which is in my 'RandomTools' package.

    I've also tried to change slot of disk 1 but it's still only 3 GB so I guess ddrescue-ing that one is not an option?
    Indeed. ddrescue will just try to copy that 3GB. Pretty useless here.
  • Mijzelf
    Mijzelf Posts: 2,790  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    @BjoWis I PM'ed you a download link to a statically linked ddrescue for Armv7. If you want to use screen, you can download the RandomTools package here, which you can extract. The screen binary is in the bin directory. If you have problems to extract it, change the extension in tgz.
    To be able to run screen, you have to execute
    ln -s ld-linux-armhf.so.3 /lib/ld-linux.so.3
    once (and again after each reboot).

  • Mijzelf
    Mijzelf Posts: 2,790  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    edited October 2022
    The .tgz extension is short for .tar.gz, which is a gzipped tar archive. Tar stands for 'tape archive', which is a way to write a series of files and/or directories linear to a tape. But it can also be used to store the same series in a single file (which can be compressed to reduce size).
    So if you extract a .tgz file, you *can* get a .tar file, but of course we want the contents of that tar file. In Windows 7-zip can do that.

    Rename the ddrescue.armv7l to ddrescue, and screen.<version> to screen. Put them in the /bin directory on the NAS. On Windows winscp can do that.
    Login over ssh, and set the executable bit for both binaries.

    chmod a+x /bin/ddrescue
    chmod a+x /bin/screen

    Provide the loader for screen:

    su
    ln -s ld-linux-armhf.so.3 /lib/ld-linux.so.3

    This actions have to be repeated after each reboot. Both the /lib and /bin directories are in ram.

    Now find out which disk is which.

    cat /proc/partitions

    A disk is something starting with sd. The old disk should have 3 partitions, for instance sda1, sda2 and sda3, and the new disk none. If you have only 2 disks inside, there should be a sda and a sdb, both about the same size (size is given in blocks, 1kB), one having 3 partitions, one either 1 or 0.

    Running ddrescue is as simple as 'ddrescue source target [mapfile]', if you ignore the zillion options. So if your old disk is sda, and the new one is sdb, the command is

    ddrescue /dev/sda /dev/sdb /tmp/mapfile

    Doublecheck the disks in /proc/partitions. Don't do it the wrong way. The mapfile is a log, which can be used to resume an action. You can also omit it. As we don't have a persistent storage, it is written on a ramdrive (/tmp), so a powerfailure will delete it, so it's probably useless. We want to do the copying in 1 run.

    Now to run it in screen, simply execute screen, and give an enter when it shows it's welcome message. Now you can execute 'ddrescue /dev/sda /dev/sdb /tmp/mapfile', and see it running. (Don't remember if ddrescue is verbose, but at least you should see disk activity). You can close your session now (by closing PuTTY, not by logging out). ddrescue will happily purr further, inside it's screen session, without knowing it's left alone.
    When you want to continue with that screen session, login over ssh, and type 'screen -r'. Screen also has a zillion further possibilities, of course. (Hey, it's open source, and it's 30+ years old. So every possible useful feature has been implemented by someone by now)




  • BjoWis
    BjoWis Posts: 33  Freshman Member
    First Comment Friend Collector
    Yes I've PM'ed you as well. My new disk has arrived and I need some guideance of what to do with your files.
  • Mijzelf
    Mijzelf Posts: 2,790  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    Did you see my previous post?
  • BjoWis
    BjoWis Posts: 33  Freshman Member
    First Comment Friend Collector
    Yes I did - trying it now, the old disk is sdb and the new is sda but I am having problem executing Screen.

    BusyBox v1.19.4 (2022-08-11 15:13:21 CST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    ~ $ su
    Password:


    BusyBox v1.19.4 (2022-08-11 15:13:21 CST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    ~ # chmod a+x /bin/ddrescue
    ~ # chmod a+x /bin/screen
    ~ # ln -s ld-linux-armhf.so.3 /lib/ld-linux.so.3
    ln: /lib/ld-linux.so.3: File exists
    ~ # cat /proc/partitions
    major minor  #blocks  name

       7        0     146432 loop0
      31        0        256 mtdblock0
      31        1        512 mtdblock1
      31        2        256 mtdblock2
      31        3      10240 mtdblock3
      31        4      10240 mtdblock4
      31        5     112640 mtdblock5
      31        6      10240 mtdblock6
      31        7     112640 mtdblock7
      31        8       6144 mtdblock8
       8        0 2930266584 sda
       8       16 2930266584 sdb
       8       17    1998848 sdb1
       8       18    1999872 sdb2
       8       19 2926266368 sdb3
      31        9     102424 mtdblock9
       9        0    1997760 md0
       9        1    1998784 md1
      31       10       4464 mtdblock10
    ~ # screen
    Cannot find terminfo entry for 'xterm'.
    ~ # screen -?
    Use: screen [-opts] [cmd [args]]
     or: screen -r [host.tty]

    Options:
    -a            Force all capabilities into each window's termcap.
    -A -[r|R]     Adapt all windows to the new display width & height.
    -c file       Read configuration file instead of '.screenrc'.
    -d (-r)       Detach the elsewhere running screen (and reattach here).
    -dmS name     Start as daemon: Screen session in detached mode.
    -D (-r)       Detach and logout remote (and reattach here).
    -D -RR        Do whatever is needed to get a screen session.
    -e xy         Change command characters.
    -f            Flow control on, -fn = off, -fa = auto.
    -h lines      Set the size of the scrollback history buffer.
    -i            Interrupt output sooner when flow control is on.
    -l            Login mode on (update /var/run/utmp), -ln = off.
    -ls [match]   or
    -list         Do nothing, just list our SockDir [on possible matches].
    -L            Turn on output logging.
    -m            ignore $STY variable, do create a new screen session.
    -O            Choose optimal output rather than exact vt100 emulation.
    -p window     Preselect the named window if it exists.
    -q            Quiet startup. Exits with non-zero return code if unsuccessful.
    -Q            Commands will send the response to the stdout of the querying process.
    -r [session]  Reattach to a detached screen process.
    -R            Reattach if possible, otherwise start a new session.
    -s shell      Shell to execute rather than $SHELL.
    -S sockname   Name this session <pid>.sockname instead of <pid>.<tty>.<host>.
    -t title      Set title. (window's name).
    -T term       Use term as $TERM for windows, rather than "screen".
    -U            Tell screen to use UTF-8 encoding.
    -v            Print "Screen version 4.02.01 (GNU) 28-Apr-14".
    -wipe [match] Do nothing, just clean up SockDir [on possible matches].
    -x            Attach to a not detached screen. (Multi display mode).
    -X            Execute <cmd> as a screen command in the specified session.



  • Mijzelf
    Mijzelf Posts: 2,790  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    Oh, dear! I overlooked that problem. The RandomTools package also has a directory /share/terminfo/. Copy that to the NAS. If you put it in the root it's fine. Then start screen with

    TERMINFO=/share/terminfo screen
  • BjoWis
    BjoWis Posts: 33  Freshman Member
    First Comment Friend Collector
    Ok thanks! Now I got it running, so now I just need to wait for a couple of days/weeks :)

    login as: admin n
    admin@NAS542's password:


    BusyBox v1.19.4 (2022-08-11 15:13:21 CST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    ~ $ screen -r
    [!p[?3;4l[4l>[?1049h[4l[?1h=[0m(B[1;24r[H[2J[H[2J

    BusyBox v1.19.4 (2022-08-11 15:13:21 CST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    ~ $ ddrescue /dev/sdb /dev/sda /tmp/mapfile
    ddrescue: /dev/sda: Output file exists and is not a regular file.
    ddrescue: Use '--force' if you really want to overwrite it, but be
              aware that all existing data in the output file will be lost.
    Try 'ddrescue --help' for more information.
    ~ $ su
    Password:


    BusyBox v1.19.4 (2022-08-11 15:13:21 CST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    ~ # ddrescue /dev/sdb /dev/sda /tmp/mapfile
    ddrescue: /dev/sda: Output file exists and is not a regular file.
    ddrescue: Use '--force' if you really want to overwrite it, but be
              aware that all existing data in the output file will be lost.
    Try 'ddrescue --help' for more information.
    ~ #
    ~ # ddrescue /dev/sdb /dev/sda /tmp/mapfile[J --force
    GNU ddrescue 1.26
    Press Ctrl-C to interrupt

    Copying non-tried blocks... Pass 1 (forwards)
    [A[A[A[A[A[A     ipos:  683606 kB, non-trimmed:        0 B,  current rate:   3145 kB/s
         opos:  683606 kB, non-scraped:        0 B,  average rate:   1381 kB/s
    non-tried:    2999 GB,  bad-sector:        0 B,    error rate:       0 B/s
      rescued:  683606 kB,   bad areas:        0,        run time:      8m 15s
    pct rescued:    0.02%, read errors:        0,  remaining time: 37d 20h 14m
                                  time since last successful read:          0s
    Copying non-tried blocks... Pass 1 (forwards)


    I have tried closing down PuTTY and then log on once again and 'screen -r' works just fine!


    login as: admin
    admin@NAS542's password:


    BusyBox v1.19.4 (2022-08-11 15:13:21 CST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    ~ $ screen -r
    [!p[?3;4l[4l>[?1049h[4l[?1h=[0m(B[1;24r[H[2J[H[2J[10Caware that all existing data in the output file will be lost.
    Try 'ddrescue --help' for more information.
    ~ $ su
    Password:


    BusyBox v1.19.4 (2022-08-11 15:13:21 CST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    ~ # ddrescue /dev/sdb /dev/sda /tmp/mapfile
    ddrescue: /dev/sda: Output file exists and is not a regular file.
    ddrescue: Use '--force' if you really want to overwrite it, but be[56D
    aware that all existing data in the output file will be lost.
    Try 'ddrescue --help' for more information.
    ~ # ddrescue /dev/sdb /dev/sda /tmp/mapfile --force
    GNU ddrescue 1.26
    Press Ctrl-C to interrupt[20D
    [A     ipos:  999751 kB, non-trimmed:        0 B,  current rate:   1048 kB/s
         opos:  999751 kB, non-scraped:        0 B,  average rate:   1418 kB/s
    non-tried:    2999 GB,  bad-sector:        0 B,    error rate:       0 B/s
      rescued:  999751 kB,   bad areas:        0,        run time:     11m 45s
    pct rescued:    0.03%, read errors:        0,  remaining time: 16d 13h 18m
                                  time since last successful read:          0s


  • Mijzelf
    Mijzelf Posts: 2,790  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    edited October 2022
    now I just need to wait for a couple of days/weeks
    When I extrapolate your measure points:

    run time:      8m 15s
    remaining time: 37d 20h 14m

    run time:    11m 45s
    remaining time: 16d 13h 18m

    It will be done in 4 more minutes! ;)

  • BjoWis
    BjoWis Posts: 33  Freshman Member
    First Comment Friend Collector
    Haha, not quite =)

    After 25 hours running - I'm at 4,49 % completed

    [A     ipos:  134728 MB, non-trimmed:        0 B,  current rate:    262 kB/s
         opos:  134728 MB, non-scraped:        0 B,  average rate:   1489 kB/s
    non-tried:    2865 GB,  bad-sector:        0 B,    error rate:       0 B/s
      rescued:  134728 MB,   bad areas:        0,        run time:  1d  1h  7m
    pct rescued:    4.49%, read errors:        0,  remaining time: 21d 10h 42m
                                  time since last successful read:          0s

Consumer Product Help Center