Thread: How to mount a compressed backup HDD image (the tricky way)
few days ago tried restore single file compressed partition image file generated partimage. unfortunately had bad luck .once checked faqs on official website found out kind of backups useless. mean saying useless can backup , restore entire partition of hard drive cannot decompress, browse or mount archive , cannot restore single file/folder or group of files/folders. pity because of people perform kind of backup typically want able restore specific files later on.
so... here solution have found out , hope might there want mount backups , browse , restore single files seamlessly.
make sure have installed dd , squashfs
the backup file generated dd raw data , have same size source partition. if source partition 20 gb need minimum 20 gb of free space on destination drive want place backup. before start process, might want fill partition zeros. way save lot of space on final squashed backup file.code:sudo apt-get install coreutils sudo apt-get install squashfs-tools
source partition have mounted in order generate zeroed file :
simplify sudo commands ,you may useswitch terminal super user session don't need type sudo every timecode:sudo -s
once done have delete it:code:dd if=/dev/zero of=/media/yourpartition/big_file_full_of_zeros bs=1024
if need full hard disk backup (including of partitions)than have repeat same procedure each partition.once done have unmount source partitions , go.code:rm /media/yourpartition/big_file_full_of_zeros
if need full hard disk backup (including of partitions)than have same procedure each partition
need backup system or home partition cannot unmounted . in case boot cd-rom , perform backup
identify source partition , unmount it
start backup processcode:fdisk -l umount dev/sdx
when done have squash file.code:dd if=/dev/sdx of=/media/your-destination-drive/ddbackp
when ready have mount squasheddd , ddbackupcode:mksquashfs ddbackup /media/yourbackupdrive/squasheddd
first create mount points
code:mkdir /mnt/squash mkdir /mnt/ddneed examine ddbackup file in /mnt/squash in order obtain necessary information determine superblockcode:mount -t squashfs /media/drive/pathtofile/squasheddd /mnt/squash -o loop
code:fdisk -lu /mnt/squash/ddbackup![]()
offset = 512 x start block value (in case 63 ) = 32256
sudo mount -o loop,offset=32256 -t auto /mnt/squash /mnt/dd
open favorite file manager , browse , copy whatever need
thanks howto!
tried mount zipped files, , possible, takes time mount zipped image of 24g windows system partition.
used squashfs method, , ok @ beginning, squashed 24g image 16g squashfs file, while gzipped image 21g (but honest, hadn't created 0 files in free space of source partition before zipping).
when started mount squashed image, , looking proper offset, run accross strange info:
as described here, calculated offset 512x218129509=111682308608 , tried mount:code:ubuntu@ubuntu:~$ fdisk -lu /media/system.squash/system.ddbackup must set cylinders. can functions menu. disk /media/system.squash/system.ddbackup: 0 mb, 0 bytes 255 heads, 63 sectors/track, 0 cylinders, total 0 sectors units = sectors of 1 * 512 = 512 bytes disk identifier: 0x69205244 doesn't partition table selected wrong device. device boot start end blocks id system /media/system.squash/system.ddbackup1 ? 218129509 1920119918 850995205 72 unknown partition 1 has different physical/logical beginnings (non-linux?): phys=(368, 111, 45) logical=(13577, 238, 11) partition 1 has different physical/logical endings: phys=(371, 101, 51) logical=(119521, 238, 60) partition 1 not end on cylinder boundary.
ok, said ntfs:code:ubuntu@ubuntu:~$ sudo mount -o loop,offset=111682308608 -t auto /media/system.squash/system.ddbackup /media/system.image mount: must specify filesystem type
well. gave , tried mount without offsets, , got result:code:ubuntu@ubuntu:~$ sudo mount -o loop,offset=111682308608 -t ntfs /media/system.squash/system.ddbackup /media/system.image ntfs signature missing. failed mount '/dev/loop2': invalid argument device '/dev/loop2' doesn't seem have valid ntfs. maybe wrong device used? or whole disk instead of partition (e.g. /dev/sda, not /dev/sda1)? or other way around?
and works! mounted original partition, , looks same.code:ubuntu@ubuntu:~$ sudo mount -o loop -t auto /media/system.squash/system.ddbackup /media/system.image
there files in mounted image squashed file:code:ubuntu@ubuntu:~$ df -h filesystem size used avail use% mounted on /dev/loop1 16g 16g 0 100% /media/system.squash /dev/loop2 30g 24g 6.2g 80% /media/system.image /dev/sdb1 30g 24g 6.2g 80% /media/system
and diff showed no difference (well took time):code:ubuntu@ubuntu:~$ ls -l /media/system.image/ total 129084 -rwxrwxrwx 1 root root 60 2010-04-10 19:26 autoexec.bat -rwxrwxrwx 1 root root 292 2007-06-06 21:13 boot.ini -rwxrwxrwx 1 root root 259776 2005-07-13 23:06 cmldr drwxrwxrwx 1 root root 4096 2008-07-29 13:52 documents , settings -rwxrwxrwx 1 root root 47564 2004-08-03 20:38 ntdetect.com -rwxrwxrwx 1 root root 250032 2010-06-06 19:39 ntldr drwxrwxrwx 1 root root 24576 2010-06-06 20:21 program files drwxrwxrwx 1 root root 4096 2009-04-26 09:56 recycler drwxrwxrwx 1 root root 4096 2010-02-20 09:53 system volume information drwxrwxrwx 1 root root 45056 2010-06-26 10:36 windows
so, reason of this? why need no offset mount squashed image?code:ubuntu@ubuntu:~$ diff -r /media/system/ /media/system.image/ ubuntu@ubuntu:~$
in original partition table source partition starts sector 1, maybe reason:
but know exactly, why? pls explain this?code:disk /dev/sdb: 164.7 gb, 164696555520 bytes 255 heads, 63 sectors/track, 20023 cylinders units = cylinders of 16065 * 512 = 8225280 bytes disk identifier: 0x23172316 device boot start end blocks id system /dev/sdb1 * 1 3833 30788541 7 hpfs/ntfs /dev/sdb2 3834 20023 130046175 5 extended /dev/sdb5 3834 20023 130046143+ 7 hpfs/ntfs
also, mounted image appeared read-only, same mounting of zip files... squashed file mounted more faster zipped one, , big advantage.
Forum The Ubuntu Forum Community Other Discussion and Support Tutorials Outdated Tutorials & Tips How to mount a compressed backup HDD image (the tricky way)
Ubuntu
Comments
Post a Comment