lzkelley / bkup_rpimage

Script to backup a Raspberry Pi disk image
GNU General Public License v3.0
162 stars 54 forks source link

Remove image and remove bkup_rpimage #19

Open guttenb opened 4 years ago

guttenb commented 4 years ago

Hello. I'm running Raspbian Buster on a Raspberry PI 4. I'm not able to make bkup_rpimage to work, and want to remove it from my system. I have two image-files that shows up when I goes to the Documents folder and select the mnt folder, I have tried to use the sudo sh bkup_rpimage.sh umount /mnt/rpi_backup.img, but I'm only receiving a message that the mount doesn't exist. Can anyone help me?

qibinchen commented 4 years ago

I first use dd create the img on Fedora, and vim.tiny this script: 143 mount ${LOOPBACK}p7 ${MOUNTDIR} # p2 --> p7 144 mkdir -p ${MOUNTDIR}/boot 145 mount ${LOOPBACK}p6 ${MOUNTDIR}/boot # p1 --> p6 and, It's work.

zekrom-vale commented 4 years ago

I restarted my Pi and ran sudo umount -a to unmount everything not in use then I could remove the folders with sudo rm -r <folder>. I think the umount command was unesiasary as I was trying to back it up in a mounted drive that does not automatically come up when the Pi powers on.

zekrom-vale commented 4 years ago

I am giving up on this utility as it has not received an update in 15 months. Not going to trust it with my backups, and it does not work well in the first place.

This is what I get when I try it:

pi@NAS:~/bkup_rpimage $ sudo sh bkup_rpimage.sh start -c /mnt/bak/rpi.img
trap: SIGINT: bad trap
-e Starting SD Image backup process
-e Creating sparse /mnt/bak/rpi.img, the apparent size of /dev/mmcblk0
0+0 records in
0+0 records out
0 bytes copied, 0.000800162 s, 0.0 kB/s
-e Attaching /mnt/bak/rpi.img to /dev/loop0
-e Copying partition table from /dev/mmcblk0 to /dev/loop0
Checking that no-one is using this disk right now ... OK

Disk /dev/loop0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x161a1b16

Old situation:

>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new DOS disklabel with disk identifier 0x0006627b.
/dev/loop0p1: Created a new partition 1 of type 'W95 FAT16 (LBA)' and of size 2.4 GiB.
/dev/loop0p2: Created a new partition 2 of type 'Extended' and of size 12.1 GiB.
/dev/loop0p3: Created a new partition 5 of type 'Linux' and of size 32 MiB.
/dev/loop0p6: Sector 5046272 is already allocated.
Created a new partition 6 of type 'W95 FAT32 (LBA)' and of size 256 MiB.
/dev/loop0p7: Sector 5570560 is already allocated.
Created a new partition 7 of type 'Linux' and of size 11.8 GiB.
/dev/loop0p8: Done.

New situation:
Disklabel type: dos
Disk identifier: 0x0006627b

Device       Boot   Start      End  Sectors  Size Id Type
/dev/loop0p1         8192  4976562  4968371  2.4G  e W95 FAT16 (LBA)
/dev/loop0p2      4976563 30253055 25276493 12.1G  5 Extended
/dev/loop0p5      4980736  5046269    65534   32M 83 Linux
/dev/loop0p6      5048318  5572603   524286  256M  c W95 FAT32 (LBA)
/dev/loop0p7      5574652 30253055 24678404 11.8G 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Invalid argument
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
Syncing disks.
-e Formatting partitions
mkfs.fat 4.1 (2017-01-24)
mke2fs 1.44.5 (15-Dec-2018)
Found a dos partition table in /dev/loop0p2
Proceed anyway? (y,N) y
mkfs.ext4: inode_size (128) * inodes_count (0) too big for a
        filesystem with 0 blocks, specify higher inode_ratio (-i)
        or lower inode count (-N).

e2fsck 1.44.5 (15-Dec-2018)
e2fsck: Attempt to read block from filesystem resulted in short read while trying to open /dev/loop0p2
Could this be a zero-length partition?
tune2fs 1.44.5 (15-Dec-2018)
tune2fs: option requires an argument -- 'U'
Usage: tune2fs [-c max_mounts_count] [-e errors_behavior] [-f] [-g group]
        [-i interval[d|m|w]] [-j] [-J journal_options] [-l]
        [-m reserved_blocks_percent] [-o [^]mount_options[,...]]
        [-r reserved_blocks_count] [-u user] [-C mount_count]
        [-L volume_label] [-M last_mounted_dir]
        [-O [^]feature[,...]] [-Q quota_options]
        [-E extended-option[,...]] [-T last_check_time] [-U UUID]
        [-I new_inode_size] [-z undo_file] device

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): Disk /dev/loop0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0006627b

Device       Boot   Start      End  Sectors  Size Id Type
/dev/loop0p1         8192  4976562  4968371  2.4G  e W95 FAT16 (LBA)
/dev/loop0p2      4976563 30253055 25276493 12.1G  5 Extended
/dev/loop0p5      4980736  5046269    65534   32M 83 Linux
/dev/loop0p6      5048318  5572603   524286  256M  c W95 FAT32 (LBA)
/dev/loop0p7      5574652 30253055 24678404 11.8G 83 Linux

Command (m for help):
Expert command (m for help):
Enter the new disk identifier:
Disk identifier changed from 0x0006627b to 0x0006627b.

Expert command (m for help):
Command (m for help): Disk /dev/loop0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0006627b

Device       Boot   Start      End  Sectors  Size Id Type
/dev/loop0p1         8192  4976562  4968371  2.4G  e W95 FAT16 (LBA)
/dev/loop0p2      4976563 30253055 25276493 12.1G  5 Extended
/dev/loop0p5      4980736  5046269    65534   32M 83 Linux
/dev/loop0p6      5048318  5572603   524286  256M  c W95 FAT32 (LBA)
/dev/loop0p7      5574652 30253055 24678404 11.8G 83 Linux

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Invalid argument

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

-e Mounting /dev/loop01 and /dev/loop02 to /mnt/rpi.img/
mount: /mnt/rpi.img: can't read superblock on /dev/loop0p2.
-e Skipping rsync since /mnt/rpi.img/ is not a mount point
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/loop0p1        2422     1      2422   1% /mnt/rpi.img/boot
devtmpfs            1824     0      1824   0% /dev
-e Flushing to disk
-e Unmounting /dev/loop01 and /dev/loop02 from /mnt/rpi.img/
umount: /mnt/rpi.img/: not mounted.
rmdir: failed to remove '/mnt/rpi.img/': Directory not empty
-e Detaching /mnt/bak/rpi.img from /dev/loop0
-e SD Image backup process completed.