Skip to content

Instantly share code, notes, and snippets.

@leolin310148
Last active November 22, 2019 12:46
Show Gist options
  • Save leolin310148/e545438aecba9cc4c9c313ee2c2ed8bb to your computer and use it in GitHub Desktop.
Save leolin310148/e545438aecba9cc4c9c313ee2c2ed8bb to your computer and use it in GitHub Desktop.

Revisions

  1. leolin310148 revised this gist Jan 18, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion solve.md
    Original file line number Diff line number Diff line change
    @@ -26,4 +26,4 @@ ensure_loop $LOOP_B

    `sh /tmp/loopback.sh`

    Thank you from (https://www.xdelve.com/article/80.html)[https://www.xdelve.com/article/80.html]
    Thank you from https://www.xdelve.com/article/80.html
  2. leolin310148 revised this gist Jan 18, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions solve.md
    Original file line number Diff line number Diff line change
    @@ -25,3 +25,5 @@ ensure_loop $LOOP_B


    `sh /tmp/loopback.sh`

    Thank you from (https://www.xdelve.com/article/80.html)[https://www.xdelve.com/article/80.html]
  3. leolin310148 renamed this gist Jan 18, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. leolin310148 created this gist Jan 18, 2017.
    27 changes: 27 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    Create `loopback.sh` in `tmp`

    ```
    #!/bin/bash
    ensure_loop(){
    num="$1"
    dev="/dev/loop$num"
    if test -b "$dev"; then
    echo "$dev is a usable loop device."
    return 0
    fi
    echo "Attempting to create $dev for docker ..."
    if ! mknod -m660 $dev b 7 $num; then
    echo "Failed to create $dev!" 1>&2
    return 3
    fi
    return 0
    }
    LOOP_A=$(losetup -f)
    LOOP_A=${LOOP_A#/dev/loop}
    LOOP_B=$(expr $LOOP_A + 1)
    ensure_loop $LOOP_A
    ensure_loop $LOOP_B
    ```


    `sh /tmp/loopback.sh`