Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 816  / 2 Years ago, wed, october 26, 2022, 9:30:03

I follow the instruction in this post, using the command



dd if=/dev/sda1 | gzip > disk.img.gz


but the imaging does not seem to stop. Is it because the disk.img is being put (as default) in my Home folder, which is on the same /dev/sda1 partition that I am imaging? (The size of /dev/sda1 is 24GB, but the img file is 32 GB and counting)



 Device Boot      Start         End      Blocks   Id  System
/dev/sda1 * 2048 484491263 242244608 83 Linux
/dev/sda2 484493310 488396799 1951745 5 Extended
/dev/sda5 484493312 488396799 1951744 82 Linux swap / Solaris


If so, given my partition scheme, to solution is to cd to an external hard drive then use the above command?



EDIT: Added the output of lsblk



 NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 231G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 1.9G 0 part [SWAP]

More From » 12.04

 Answers
3

Device Boot      Start         End      Blocks   Id  System
/dev/sda1 * 2048 484491263 242244608 83 Linux



1 block is 512 bytes. 242244608 blocks is 115.5 GiB, not 24 as you mentioned. The dd command (refered by you as "imaging") keeps writing data to the same partition that you are cloning. This does not cause any loops, but it may yield a corrupt filesystem image (disk.img.gz).



What you should do is:




  1. Reboot to a Live CD.

  2. Ensure that your source partition is not mounted.

  3. Mount a different target partition (e.g. your external hard disk).

  4. Use dd to write the image to your second partition.



Even better, if you do not need to have an identical filesystem copy, just use rsync to copy your files and metadata (permissions). For this you need your backup target to have the same filesystem type (ext4) such that permissions and ACLs are preserved. See https://wiki.archlinux.org/index.php/Full_System_Backup_with_rsync for details on using rsync.


[#28801] Thursday, October 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ledeball

Total Points: 434
Total Questions: 121
Total Answers: 120

Location: Antigua and Barbuda
Member since Sat, Apr 24, 2021
3 Years ago
;