実行中のLinuxディストリビューションを.imgまたは.isoにバックアップする方法

実行中のLinuxディストリビューションを.imgまたは.isoにバックアップする方法

アーチベースのディストリビューションを使用していますマンジャロ Linux。フルファイルシステムは約6GBです。 imgやisoでバックアップしたいです。

これまで私が見つけたのは

  1. クロニズラ。しかし、これまで私が見つけたのは、clonezillaが実行されているシステムからバックアップできないことです。

  2. dd - dd はあるブロックから別のブロックにコピーします。 250GBをすべてバックアップしたくありません。使った6GBだけバックアップしたいです。

  3. 頑張ったこのsyncFilesystemToImage.sh gitスニペット

    # source - https://gist.github.com/geoffreyanderson/1004950
    
    imageFile=${1:-"awsImage-$(date +%m%d%y-%H%M).img"}
    imageMountPoint=${2:-'/mnt/image'}
    
    echo "Creating empty 10GB image in ${imageFile}"
    # Create an empty 10GB image file
    dd if=/dev/zero of=${imageFile} bs=1M count=10240
    
    echo "Creating filesystem in ${imageFile}"
    # Create a filesystem on the image file
    /sbin/mke2fs -F -j ${imageFile}
    
    echo "Mounting ${imageFile} loopback at ${imageMountPoint}"
    # Create the directories needed for imaging
    mkdir -p ${imageMountPoint}
    mount -o loop ${imageFile} ${imageMountPoint}
    
    echo "Beginning rsync..."
    rsync --stats -av --exclude=/root/.bash_history --exclude=/home/*/.bash_history --exclude=/etc/ssh/ssh_host_* --exclude=/etc/ssh/moduli --exclude=/etc/udev/rules.d/*persistent-net.rules --exclude=/mnt/* --exclude=/proc/* --exclude=/tmp/* --exclude=/sys/* --exclude=/dev/* / ${imageMountPoint}
    
    
    echo "rsync finished. Flushing copied log data..."
    #clear out any remaining log data
    cd ${imageMountPoint}/var/log
    for i in `ls ./**/*`; do
      echo $i && echo -n> $i
    done
    
    # Create base devices (console, null, zero) under the completed image
    for i in console null zero ; do MAKEDEV -d ${imageMountPoint}/dev -x $i ; done
    
    # get out of the image mount point so we can successfully unmount
    cd /
    
    # Sync changes and unmount the image
    sync
    umount ${imageMountPoint}
    rmdir ${imageMountPoint}
    

    ただし、スクリプトはどこでも失敗しますrsync。 10GBでは足りないと言いましたね。なぜ10GBが6GBをバックアップするのに十分ではないのかわかりません。 ˙\_(ツ)_/˙

オプションがありますシステムの背景これらの問題を解決するためにUbuntuを使用してください。アーチベースの展開のためのソリューションはありますか?

ベストアンサー1

おすすめ記事