Did a test using an USB disk I had available.
It is a 500 GB NTFS drive with half of the space free.
So I mounted it into /mnt/nasdisk and ran the following commands:
Code: Select all
$ sudo su
# mount /dev/sda1 /mnt/nasdisk
# time imgclone -d /mnt/nasdisk/RPI/testimg.img
After 40 seconds it finished, but there were a lot of error messages on screen.
Still the testimg.img file was created and sized about 5.6 GB:
Code: Select all
i# ls -la /mnt/nasdisk/RPI/
total 21192
drwxrwxrwx 1 root root 0 Aug 4 19:31 .
drwxrwxrwx 1 root root 4096 Aug 4 19:21 ..
-rwxrwxrwx 1 root root 5694170112 Aug 4 19:31 testimg.img
I just re-ran it again with this result:
Code: Select all
# time imgclone -d /mnt/nasdisk/RPI/testimg2.img
---- Raspberry Pi clone to image V1.1 ---
-----------------------------------------------
---- DO NOT CHANGE FILES ON YOUR SD CARD ---
---- WHILE THE BACKUP PROGRAM IS RUNNING ---
---- THE DESTINATION .IMG FILE MUST BE ---
---- ON AN EXTERNAL STORAGE / NETWORK SHARE ---
-----------------------------------------------
Cloning /dev/mmcblk0 to /mnt/nasdisk/RPI/testimg2.img
uuid | cut -f1 -d-
mktemp -d
mktemp -d
-----------------------------------------------
---- READING PARTITIONS ------
-----------------------------------------------
Partition 1 start: 8192 end: 532479 ptype:primary ftype:fat32 flags: lba
.Partition 2 start: 532480 end: 61120511 ptype:primary ftype:ext4 flags:
.partprobe
Last partition starts at 272629760 bytes.
mount /dev/mmcblk0p2 /tmp/tmp.fQEPvuAm6T
df /tmp/tmp.fQEPvuAm6T | tail -n 1 | tr -s " " " " | cut -d ' ' -f 2
df /tmp/tmp.fQEPvuAm6T | tail -n 1 | tr -s " " " " | cut -d ' ' -f 4
Used size of last partition is 5350297600 bytes.
umount /tmp/tmp.fQEPvuAm6T
Required size for destination image: 5745871872 bytes
-----------------------------------------------
---- ALLOCATING SPACE FOR .IMG FILE ------
-----------------------------------------------
touch "/mnt/nasdisk/RPI/testimg2.img"
df "/mnt/nasdisk/RPI/testimg2.img" | tail -n 1 | tr -s " " " " | cut -d ' ' -f 1
/dev/sda1
df --output=avail -B 1 "/mnt/nasdisk/RPI/testimg2.img" | tail -n 1
123168919552
truncate --size 5745871872 "/mnt/nasdisk/RPI/testimg2.img"
-----------------------------------------------
---- CREATING DISK DEVICE FOR .IMG FILE ------
-----------------------------------------------
losetup --show -f "/mnt/nasdisk/RPI/testimg2.img"
dd if=/dev/zero of=/dev/loop0 bs=512 count=1
1+0 records in
1+0 records out
512 bytes copied, 0.0711845 s, 7.2 kB/s
Creating FAT on /dev/loop0.
parted -s /dev/loop0 mklabel msdos
-----------------------------------------------
---- CREATING PARTITIONS PLEASE WAIT ------
-----------------------------------------------
parted -s /dev/loop0 mkpart primary fat32 8192s 532479s
partprobe
lsblk -o name,uuid /dev/mmcblk0 | grep mmcblk0p1 | tr -s " " | cut -d " " -f 2
lsblk -o name,label /dev/mmcblk0 | grep mmcblk0p1 | tr -s " " | cut -d " " -f 2
blkid /dev/mmcblk0 | rev | cut -f 2 -d ' ' | rev | cut -f 2 -d \"
mkfs.fat -F 32 -i 70A28001 /dev/loop0p1
mkfs.fat 4.1 (2017-01-24)
fatlabel /dev/loop0p1 boot
fatlabel: warning - lowercase labels might not work properly with DOS or Windows
echo "x
i
0x047f45e6
r
w
" | fdisk /dev/loop0
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):
Expert command (m for help):
Enter the new disk identifier:
Disk identifier changed from 0x14a05a21 to 0x047f45e6.
Expert command (m for help):
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).
parted -s /dev/loop0 -- mkpart primary ext4 532480s -1s
partprobe
lsblk -o name,uuid /dev/mmcblk0 | grep mmcblk0p2 | tr -s " " | cut -d " " -f 2
lsblk -o name,label /dev/mmcblk0 | grep mmcblk0p2 | tr -s " " | cut -d " " -f 2
blkid /dev/mmcblk0 | rev | cut -f 2 -d ' ' | rev | cut -f 2 -d \"
mkfs.ext4 -F -U a1fafd2b-1ef0-4fe8-8ac1-ad33bbb48642 /dev/loop0p2
mke2fs 1.44.5 (15-Dec-2018)
Creating filesystem with 1336240 4k blocks and 334560 inodes
Filesystem UUID: a1fafd2b-1ef0-4fe8-8ac1-ad33bbb48642
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
mkfs.ext4: Input/output error while writing out and closing file system
Writing superblocks and filesystem accounting information: mkfs.ext4 -F /dev/loop0p2
mke2fs 1.44.5 (15-Dec-2018)
Creating filesystem with 1336240 4k blocks and 334560 inodes
Filesystem UUID: 3938956c-593c-49a7-8db5-7ef796a4d684
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
mkfs.ext4: Input/output error while writing out and closing file system
Could not create file system.
Writing superblocks and filesystem accounting information:
real 0m28.034s
user 0m0.612s
sys 0m3.324s
So I just wonder based on the errors if I must use some other kind of USB disk to create the image on?
Can an NTFS drive be used at all?