Giter VIP home page Giter VIP logo

qnap-kernel-lvm's Introduction

QNAP kernel and lvm

Introduction

If your QNAP device is dead you cannot access the files on the disk on a linux machine. This is because QNAP has modified the kernel and lvm code. With this kernel and initrd, you can spawn a VM to access the disk contents.

I have never owned a QNAP device. This was a side project to recover the files from a QNAP disk for a colleague. The QNAP model the disk was extracted from was TS-251+. I would not know if the kernel/initrd would work for other QNAP devices.

How to use

You need a Linux host with qemu to spawn the VM.

  1. Plugin the disk to your linux host (via a usb dock)
  2. Activate the proper mdraid array (if applicable). Typically you have opted for RAID1 setup. The contents should be on the third partition.
  3. cat /proc/mdstat and activate the array with mdadm --run /dev/mdXXX
  4. Then spawn a VM using the kernel and initrd passing the mdraid array. The /dev/sdb1 here is a second disk in order to copy your files
    qemu-system-x86_64 \
    -kernel vmlinuz-3.12.6 \
    -initrd initrd-lvm.img-3.12.6 \
    -append "init=/bin/busybox console=ttyS0" \
    -nographic -m 128M \
    -drive file=/dev/md125 \
    -drive file=/dev/sdb1 \
    -serial mon:stdio
    
  5. Once booted you should be able to activate LVM volumes and copy your files
    vgchange -ay
    mkdir -p /mnt/{src,dst}
    mount /dev/mapper/vg1-lv1 /mnt/src
    mount /dev/sdb /mnt/dst
    rsync -av /mnt/src /mnt/dst
    
  6. The initrd image contains an rsync binary for convinience and also a full build of busybox with all modules (bin/busybox2)

qnap-kernel-lvm's People

Contributors

thanosz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.