Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
2
answers
2143
views
How to process dd-created disk image, which is corrupted (disk died during dumping)
I have a laptop with HDD which had issues with booting (windows10). I assumed that Windows just failed some way. I've booted from LinuxLiveUSB and tried to dump the disk using `dd`. DD failed on 85GB because of I/O error. I've read that it is sign of bad block, so I've used `NOERROR` flag next time....
I have a laptop with HDD which had issues with booting (windows10). I assumed that Windows just failed some way.
I've booted from LinuxLiveUSB and tried to dump the disk using
dd
. DD failed on 85GB because of I/O error. I've read that it is sign of bad block, so I've used NOERROR
flag next time.
During that process dd
now throws only I/O errors. I've checked disk in fdisk -l
, but see only one partition (was 4 before the whole operation) with message that there was no other partition or something (sorry I can't remember correctly).
For the next reboot to LiveUSB, fdisk
detect no sda
whatsoever. So I think, disk is dead.
I still have 270GB image (closed DD because of never-ending I/O errors) of 1TB disk. I want to recover data from this image, but neither OSFMount
on Windows nor losetup
/kpartx
can mount Windows partition from this image (OSFmount
just hangs and linux tools do nothing).
Is there any process to prepare the image in a way to read the data from it? Thanks.
tuxfan
(1 rep)
Aug 6, 2020, 10:06 AM
• Last activity: Jul 25, 2025, 08:55 PM
0
votes
1
answers
67
views
How can I extract files from a disk image backup (.image file)?
I backed up my old device using `dd` and am trying to access its contents. The following has been attempted: ``` usr@pop-os:~/Backups$ sudo mkdir /mnt/ mount -o loop .image /mnt/ mount: /mnt/ : failed to setup loop device for /home/usr/Backups/ .image. ``` The file was created by using the following...
I backed up my old device using
dd
and am trying to access its contents.
The following has been attempted:
usr@pop-os:~/Backups$ sudo mkdir /mnt/
mount -o loop .image /mnt/
mount: /mnt/: failed to setup loop device for /home/usr/Backups/.image.
The file was created by using the following command:
sudo dd if=/dev/sda of=.image status=progress
usr@pop-os:~/Backups$ fdisk -l .image
Disk .image: 29.12 GiB, 31268536320 bytes, 61071360 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: 0x38a56bdb
Device Boot Start End Sectors Size Id Type
.image1 * 10240 962559 952320 465M 83 Linux
.image2 962560 61071326 60108767 28.7G 83 Linux
usr@pop-os:~/Backups$
How can I explore the contents of a .image file?
SpreadingKindness
(23 rep)
Jul 4, 2025, 08:56 AM
• Last activity: Jul 5, 2025, 09:34 PM
2
votes
1
answers
386
views
“Bad magic number in super-block” after a dd of Mobian (Debian) image
# General overview I try to install the [Mobian](https://mobian-project.org/) OS on my Pinephone thought the [`dd`’s method](https://wiki.debian.org/InstallingDebianOn/PINE64/PinePhone#Method_3:_dd) as described in the official Debian documentation. Basically, I have to make a `dd` from an imag...
# General overview
I try to install the [Mobian](https://mobian-project.org/) OS on my Pinephone thought the [
dd
’s method](https://wiki.debian.org/InstallingDebianOn/PINE64/PinePhone#Method_3:_dd) as described in the official Debian documentation. Basically, I have to make a dd
from an image to a partition in the SD card.
# The problem
But at each try, the partition is corrupted and unusable.
# The process
### What I did
As I said, I just follow the dd
’s method of the documentation. So :
1. I formatted a partition located in /dev/sdb1
in my SD card with:
# mkfs.ext4 -F -O 64bit -L 'system' '/dev/sdb1'
mke2fs 1.47.0 (5-Feb-2023)
/dev/sdb1 contains a ext4 file system labelled 'system'
last mounted on Wed Jun 25 18:44:21 2025
Creating filesystem with 28703488 4k blocks and 7176192 inodes
Filesystem UUID: e7df3b8b-a2fa-4cce-a833-5fd86456cad8
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (131072 blocks): done
Writing superblocks and filesystem accounting information: done
2. Then, I get the image and unpack it:
$ wget https://images.mobian.org/pinephone/mobian-pinephone-phosh-12.0.img.gz
$ unp mobian-pinephone-phosh-12.0.img.gz
3. So, I copied the image to the partition /dev/sdb1
:
# dd bs=64k if=mobian-pinephone-phosh-12.0.img of=/dev/sdb1 status=progress
5989138432 octets (6,0 GB, 5,6 GiB) copiés, 265 s, 22,6 MB/s
91552+1 enregistrements lus
91552+1 enregistrements écrits
6000000000 octets (6,0 GB, 5,6 GiB) copiés, 265,823 s, 22,6 MB/s
### What I got
At this point, when the process reach it end, the partition appear as defective.
1. I check /dev/sdb1
with fsk.ext4
:
# fsck.ext4 /dev/sdb1
e2fsck 1.47.0 (5-Feb-2023)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/sdb1
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193
or
e2fsck -b 32768
Found a gpt partition table in /dev/sdb1
2. I inspected what happened with dmesg
but found nothing special:
# dmesg -T
[mer. 25 juin 18:44:02 2025] sd 3:0:0:0: [sdb] 244285440 512-byte logical blocks: (125 GB/116 GiB)
[mer. 25 juin 18:44:02 2025] sd 3:0:0:0: [sdb] Write Protect is off
[mer. 25 juin 18:44:02 2025] sd 3:0:0:0: [sdb] Mode Sense: 03 00 00 00
[mer. 25 juin 18:44:02 2025] sd 3:0:0:0: [sdb] No Caching mode page found
[mer. 25 juin 18:44:02 2025] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[mer. 25 juin 18:44:02 2025] sdb: sdb1
[mer. 25 juin 18:44:02 2025] sd 3:0:0:0: [sdb] Attached SCSI removable disk
[mer. 25 juin 18:44:02 2025] EXT4-fs (sdb1): recovery complete
[mer. 25 juin 18:44:02 2025] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Quota mode: none.
[mer. 25 juin 18:44:18 2025] EXT4-fs (sdb1): unmounting filesystem.
[mer. 25 juin 18:44:18 2025] sdb: sdb1
[mer. 25 juin 18:44:18 2025] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Quota mode: none.
[mer. 25 juin 18:44:43 2025] EXT4-fs (sdb1): unmounting filesystem.
However, I tried the same process from another computer and get something more verbose with dmesg
(in the this case mmcblk0
is the relevant partition):
[mar. juin 24 20:11:57 2025] mmcblk0: p1
[mar. juin 24 20:11:57 2025] mmcblk0: p1
[mar. juin 24 20:11:57 2025] mmcblk0: p1
[mar. juin 24 20:11:58 2025] mmcblk0: p1
[mar. juin 24 20:13:31 2025] mmc0: card 0001 removed
[mar. juin 24 20:13:33 2025] mmc0: cannot verify signal voltage switch
[mar. juin 24 20:13:33 2025] mmc0: new ultra high speed SDR104 SDXC card at address 0001
[mar. juin 24 20:13:33 2025] mmcblk0: mmc0:0001 SD128 116 GiB
[mar. juin 24 20:13:33 2025] mmcblk0: p1
[mar. juin 24 20:13:38 2025] audit: type=1400 audit(1750788819.286:29): apparmor="DENIED" operation="open" profile="/usr/bin/evince-thumbnailer" name="/tmp/tumbler-X31LB82.png" pid=13008 comm="evince-thumbnai" requested_mask="wc" denied_mask="wc" fsuid=1000 ouid=1000
[mar. juin 24 20:13:39 2025] audit: type=1400 audit(1750788819.666:30): apparmor="DENIED" operation="open" profile="/usr/bin/evince-thumbnailer" name="/tmp/tumbler-XD3SP82.png" pid=13013 comm="evince-thumbnai" requested_mask="wc" denied_mask="wc" fsuid=1000 ouid=1000
[mar. juin 24 20:15:29 2025] EXT4-fs (mmcblk0p5): mounted filesystem with ordered data mode. Quota mode: none.
[mar. juin 24 20:16:22 2025] JBD2: Spotted dirty metadata buffer (dev = mmcblk0p5, blocknr = 1). There's a risk of filesystem corruption in case of system crash.
[mar. juin 24 20:16:26 2025] EXT4-fs error (device mmcblk0p5): ext4_map_blocks:607: inode #8: block 15237146: comm jbd2/mmcblk0p5-: lblock 26 mapped to illegal pblock 15237146 (length 1)
[mar. juin 24 20:16:26 2025] jbd2_journal_bmap: journal block not found at offset 26 on mmcblk0p5-8
[mar. juin 24 20:16:26 2025] Aborting journal on device mmcblk0p5-8.
[mar. juin 24 20:16:26 2025] EXT4-fs error (device mmcblk0p5): ext4_journal_check_start:83: comm ext4lazyinit: Detected aborted journal
[mar. juin 24 20:16:27 2025] EXT4-fs (mmcblk0p5): Remounting filesystem read-only
[mar. juin 24 20:23:19 2025] EXT4-fs (mmcblk0p5): unmounting filesystem.
[mar. juin 24 20:23:42 2025] mmcblk0: p1
[mar. juin 24 20:23:42 2025] mmcblk0: p1
[mar. juin 24 20:23:42 2025] mmcblk0: p1
[mar. juin 24 20:23:43 2025] mmcblk0:
[mar. juin 24 20:23:43 2025] mmcblk0:
[mar. juin 24 20:23:43 2025] mmcblk0: p1
[mar. juin 24 20:23:43 2025] mmcblk0: p1
# The question
Obviously, I just ask what happened, why it doesn’t work? And how to fix it and install Mobian on this SD card?
fauve
(1529 rep)
Jun 25, 2025, 05:44 PM
• Last activity: Jun 26, 2025, 03:04 AM
20
votes
3
answers
25473
views
How to find which images belong to which /dev/loop?
I work a lot with imaged drives, meaning a do a dd-copy of the drive in question and then work on the image instead of the drive itself. For most work, I use kpartx to map the drive's partitions to a device under /dev/mapper/. What I'm wondering here is if there's a way to find which of the mapping...
I work a lot with imaged drives, meaning a do a dd-copy of the drive in question and then work on the image instead of the drive itself.
For most work, I use kpartx to map the drive's partitions to a device under /dev/mapper/. What I'm wondering here is if there's a way to find which of the mapping belong to which image.
Consider this:
root@vyvyan:/tmp# kpartx -a -v Image1
add map loop1p1 (254:4): 0 10240 linear /dev/loop1 2048
add map loop1p2 (254:5): 0 10240 linear /dev/loop1 12288
add map loop1p3 (254:6): 0 52848 linear /dev/loop1 22528
root@vyvyan:/tmp# kpartx -a -v Image2
add map loop2p1 (254:7): 0 33508 linear /dev/loop2 2048
add map loop2p2 (254:8): 0 39820 linear /dev/loop2 35556
Now, let's say I forget which image went to which mapping. Is there a way to let kpartx - or the kernel, or anything else - tell me which image goes where?
*EDIT* Also, if I accidentally rm the image-file while kpartx has added the mappings, how do you remove the mappings? kpartx wants the actual image to be present.
bos
(907 rep)
Dec 9, 2014, 08:14 PM
• Last activity: Jun 17, 2025, 04:35 PM
2
votes
1
answers
4642
views
Requirements to boot a rootfs.img file
I have a Linux image from which I've extracted a `rootfs.img` file. The file seems to contain files and information. I would like to "boot into it". File contents: ``` bin dev etc home lib media mnt proc run sbin service sys tmp usr var lib64 ``` How can I install a bootloader to boot it? I've tried...
I have a Linux image from which I've extracted a
rootfs.img
file. The file seems to contain files and information. I would like to "boot into it".
File contents:
bin
dev
etc
home
lib
media
mnt
proc
run
sbin
service
sys
tmp
usr
var
lib64
How can I install a bootloader to boot it?
I've tried getting a live Ubuntu image, adding a partition, and placing the contents of rootfs.img
inside the partition and running "Boot Repair", which did find the other system as another bootable Linux, but I can't boot into it, it seems like I'm missing something
Anonymous
(21 rep)
Oct 3, 2019, 08:43 AM
• Last activity: Jun 14, 2025, 03:09 AM
0
votes
2
answers
44
views
how to copy a HD to another if the CPU is freezing after a few GB?
how to copy a HD to another if the CPU is freezing after a few GB ? I had to copy w11 of a friend notebook from a 128GB nvme to a 1TB nvme. I put nvne128gb in a usb adapter and the nvme1TB inside the notebook. The only cost free and granted way to copy the hd was thu linux (that i use everyday). I b...
how to copy a HD to another if the CPU is freezing after a few GB ?
I had to copy w11 of a friend notebook from a 128GB nvme to a 1TB nvme.
I put nvne128gb in a usb adapter and the nvme1TB inside the notebook.
The only cost free and granted way to copy the hd was thu linux (that i use everyday).
I boot it in a usb liveCD ubuntu 24.04.
when I try to copy using gparted or dd, the pc freezes everytime around 15GB :(
What is going on?
VeganEye
(101 rep)
Jun 2, 2025, 09:12 PM
• Last activity: Jun 2, 2025, 10:04 PM
0
votes
1
answers
84
views
Coldsnap download disk.img not getting mounted on linux machine
I am trying to mount an image file which has been downloaded by coldsnap for a snapshot of AWS, but I am unable to mount it in Amazon Linux 2. I Tried multiple commands as `mount -o loop disk.img /mnt/disk`, `losetup -f disk.img && mount /dev/loop0 /mnt/disk` but it's not working: ```lang-shellsessi...
I am trying to mount an image file which has been downloaded by coldsnap for a snapshot of AWS, but I am unable to mount it in Amazon Linux 2.
I Tried multiple commands as
mount -o loop disk.img /mnt/disk
, losetup -f disk.img && mount /dev/loop0 /mnt/disk
but it's not working:
-shellsession
[root@ip-172-31-29-177 ec2-user]# mount -t ext4 /dev/loop0 /tmp/disk/
mount: /tmp/disk: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
Can anyone please help me on this error?
Jayesh Desai
(1 rep)
Jun 27, 2024, 11:20 AM
• Last activity: May 12, 2025, 07:47 AM
3
votes
0
answers
368
views
How to boot a writable disk image (created with dd from Debian or another distribution) with GRUB?
I created a `multi-boot` USB stick to load various ISO files, which can either be live systems or used to install different Linux distributions. ``` sda -sda1 1M | BIOS Boot partition to store MBR -sda2 64M | ESP for UEFI boot -sda3 100G | EXT4 for ISO & IMAGE ``` I can easily start ISO files such a...
I created a
multi-boot
USB stick to load various ISO files, which can either be live systems or used to install different Linux distributions.
sda
-sda1 1M | BIOS Boot partition to store MBR
-sda2 64M | ESP for UEFI boot
-sda3 100G | EXT4 for ISO & IMAGE
I can easily start ISO files such as Debian, Ubuntu, Kali or other distributions from it, using the corresponding menuentry
in the
/efi/boot/grub/grub.cfg
Now I have an disk-image
created with dd
from a whole USB stick where Debian is installed.
However, it's not a true ISO or image but rather a disk-image
(snapshot/backup) of the USB stick with all its partitions, with the named example debian1.iso
or debian2.img
I've now copied this file to the partition sda3
with the other correct ISO's.
I created the following menuentry
with chainloader
, but on the first attempt, GRUB simply restarts the boot process, and on the second attempt, I get an 'invalid signature' error.
menuentry "Chainload GRUB from USB Image debian1.iso" {
loopback loop (hd0,3)/debian1.iso
set root=(loop,1)
chainloader +1
}
menuentry "Boot Debian from ISO on USB (UEFI)" {
set root=(hd0,3)
loopback loop /debian2.img
set root=(loop,1)
chainloader /EFI/debian/grubx64.efi
}
How can I start this disk-image from GRUB and what does the menu entry look like?
It might be possible if the disk-image is written to a separate partition, but I don’t want that.
Here are entries I found, but they mostly deal with ISO files.
- GRUB2: boot to a second (another) hard disk
- Using a bootable live cd disk image mounted on the hard drive
- Booting an EXT4 image file from GRUB2
- how to chainload from image file which contain multiple partitions?
- install grub on disk image
- How to boot Linux from image on disk or "Poor Man's Install"?
- GRUB Boot ISO/disk image from NTFS partition
- MEMDISK can boot floppy images, hard disk images and some ISO images.
At first, I found that it wasn’t possible, but then I discovered that it might be possible with memdisk
or GRUB2
using loopback
and overlayfs
.
So, it is indeed possible.
**Memdisk
**
> Memdisk
is primarily intended for temporary boot environments
,
> such as starting installation programs or diagnostic tools where
> permanent storage is not required or desired.
It is very useful if you just want to test the disk image.
**loopback
and overlayfs
**
> You can boot a disk image with GRUB
’s loopback
function and make the
> filesystem writable by combining it with overlayfs
. An overlay layer
> is placed on top of the read-only image, writing changes to a separate
> partition or file. This way, the original image remains unchanged, and
> you can save modifications.
I need to figure out how to handle the changes if it works.
My GRUB is installed on a USB stick without an operating system, so I can't use grub-mkconfig
.
So I have to make all the changes manually.
Is it possible to boot a disk-image
via GRUB
that is writable, make changes, and have those changes written directly to the image and how?
Is there another way besides memdisk
to boot where I can make changes?
If it works with loopback
and overlayfs
, what do I need to consider, how do I set it up, and what does the menuentry
looks like?
Is there some kind of small hack, or should I load additional files onto the GRUB stick to make this work and how?
The disk image itself also has GRUB, and the operating system on it is encrypted with LUKS.
Is it maybe possible to unpack the image into memory with GRUB, call GRUB from the disk image, unlock LUKS, boot the OS, make the changes, and save the whole thing as a new disk image to some partition?
ReflectYourCharacter
(8185 rep)
Aug 30, 2024, 05:54 PM
• Last activity: Apr 19, 2025, 11:03 AM
5
votes
2
answers
402
views
How to get name of loop device that contains a LUKS-encrypted logical volume
In Ubuntu, I have mounted a raw disk .img file as a loop device that contains a LUKS encrypted LVM with an Ubuntu install on it. It is mounted like so: (output is from `lsblk -o NAME,PKNAME,KNAME,FSTYPE,SIZE /dev/loop0` ```` NAME PKNAME KNAME FSTYPE SIZE loop0 loop0 240G ├─loop0p1 loop0 dm-11 ext4 4...
In Ubuntu, I have mounted a raw disk .img file as a loop device that contains a LUKS encrypted LVM with an Ubuntu install on it.
It is mounted like so: (output is from
lsblk -o NAME,PKNAME,KNAME,FSTYPE,SIZE /dev/loop0
`
NAME PKNAME KNAME FSTYPE SIZE
loop0 loop0 240G
├─loop0p1 loop0 dm-11 ext4 487M
├─loop0p2 loop0 dm-12 1K
└─loop0p5 loop0 dm-13 crypto_LUKS 239.5G
└─cloneluks dm-13 dm-14 LVM2_member 239.5G
├─ubuntuclone-lv_swap dm-14 dm-15 8G
└─ubuntuclone-lv_root dm-14 dm-16 ext4 231.5G
`
Is there any command that I can use in a script to return the root "block device" (I'm not sure if that's the correct term), when I give the mounted LV name?
I was hoping that lsblk -no pkname /dev/ubuntuclone/lv_root
would work, but it outputs nothing - using kname
gives me dm-16
.
I want to get to loop0
.
I also saw [this answer](https://unix.stackexchange.com/a/308724/52247) which implied I could use "$(basename "$(readlink -f /dev/VG/LV)")"
, but I couldn't work out how to use it:
`
dev=/dev/ubuntuclone/lv_root ; echo "$(basename "$(readlink -f $dev)")"
`
outputs dm-16
.
I can't work out how to get "past" the crypto_LUKS container.
This is what I'm looking for:
for input:
/dev/ubuntuclone/lv_root
or ubuntuclone-lv_root
I would like to get output:
/dev/loop0
Thanks.
edit: I think using lsblk --json | jq
might be exactly what I want, but I'm having a lot of trouble working out the correct incantations for jq
...
localhost
(327 rep)
Apr 11, 2025, 08:36 AM
• Last activity: Apr 11, 2025, 08:51 PM
1
votes
1
answers
43
views
permanent vnconfig OpenBSD?
I can manually mount an image file (containing a valid filesystem) with: ```lang-sh vnconfig vnd0 file.img mount /dev/vnd0c /mnt/ ``` **Question**: Where should I put the `vnconfig` command in OpenBSD? I updated `fstab` to have the mount, but `vnconfig` is still a mystery. Where should I put it? In...
I can manually mount an image file (containing a valid filesystem) with:
-sh
vnconfig vnd0 file.img
mount /dev/vnd0c /mnt/
**Question**: Where should I put the vnconfig
command in OpenBSD?
I updated fstab
to have the mount, but vnconfig
is still a mystery. Where should I put it? In a startup script?
robert8819
(21 rep)
Dec 6, 2024, 02:36 PM
• Last activity: Jan 9, 2025, 09:39 AM
1
votes
0
answers
25
views
User space program for assembling Linux MD RAID disk images into a coalesced disk image, without using kernel implementation
I've been handed a set of disk images which apparently are Linux MD RAID, asking if I could "reassemble" them. Using a Linux kernel it's as easy as attaching them into partition scanned loopback devices (`losetup -fP `) and then have the kernel assemble them, by issuing the right `mdadm` stanza. How...
I've been handed a set of disk images which apparently are Linux MD RAID, asking if I could "reassemble" them. Using a Linux kernel it's as easy as attaching them into partition scanned loopback devices (
losetup -fP
) and then have the kernel assemble them, by issuing the right mdadm
stanza.
However, I was wondering if there's a tool that would take a bunch of Linux MD RAID images assembling and digesting it into a mountable disk image file.
My main motivation is, that assembling via kernel might cause user whoopsies on a system that nominally uses MD RAID and you'd have to spin up a dedicated VM if you'd want to isolate the process. And this seems like a kludge that rubs me the wrong way.
datenwolf
(369 rep)
Dec 19, 2024, 09:46 AM
0
votes
0
answers
96
views
unsquashfs tool to extract files from an image file
Just to be clear: linux tool `unsquashfs(1)` takes as input the name of a `squashfs` filesystem **image** file. In other words the file we pass to it is a "bit by bit" image of a squashfs filesystem stored within blocks of an disk (or RAM disk). Basically it *extracts* files and directories within t...
Just to be clear: linux tool
unsquashfs(1)
takes as input the name of a squashfs
filesystem **image** file.
In other words the file we pass to it is a "bit by bit" image of a squashfs filesystem stored within blocks of an disk (or RAM disk). Basically it *extracts* files and directories within the squashfs filesystem into a directory on the "host system" passed to it by its name.
Is the above correct? Thanks.
CarloC
(385 rep)
Nov 3, 2024, 07:56 AM
• Last activity: Nov 3, 2024, 11:28 AM
1
votes
2
answers
294
views
How to make an image of your Linux Install
I'm looking to physically replace my current linux boot hard drive with a new hard drive, but want to 'copy' the existing boot drive contents onto that new drive. I assume the best way to do this is to create an image of the current one and then restore it onto the new drive. I'd appreciate some det...
I'm looking to physically replace my current linux boot hard drive with a new hard drive, but want to 'copy' the existing boot drive contents onto that new drive.
I assume the best way to do this is to create an image of the current one and then restore it onto the new drive.
I'd appreciate some details on doing this. In particular, I assume that the fstab will need to be edited for the new drive after restoring the image onto it.
Thanks!
dtx1
(39 rep)
Oct 22, 2024, 01:57 AM
• Last activity: Oct 25, 2024, 05:14 AM
5
votes
2
answers
1392
views
Does GNU Tar have a single option to get absolutely everything about a tree
I'm in a situation where I want the kind of guarantees of getting every bit of data and metadata about a tree of files that might normally require using dump/restore. I need *everything* uids, gids, permissions, hardlinks, attributes, xattrs, and anything else I might not even know about. And it wou...
I'm in a situation where I want the kind of guarantees of getting every bit of data and metadata about a tree of files that might normally require using dump/restore. I need *everything* uids, gids, permissions, hardlinks, attributes, xattrs, and anything else I might not even know about. And it would save me a lot of effort if I could do this for a tree instead of an image file, so dump is not the preferred path.
Is there any simplified option or set of options for GNU Tar that guarantee it will catch everything? Or am I stuck with
--xattrs-include='*'
or --xattrs-include='*.*'
and hoping I know everything?
davolfman
(847 rep)
Oct 16, 2024, 06:02 PM
• Last activity: Oct 17, 2024, 06:16 PM
0
votes
0
answers
132
views
How to create an .img from a LVM Logical Volume
I have some LVM logical volumes in a machine, and I would like to create backup images (`.img`) stored in another machine. 1. Most volumes are LVM-Thin, and I cannot resize the volumes before creating the images. Then, how to keep the image files as small as possible? 1. Is `dd` capable of creating...
I have some LVM logical volumes in a machine, and I would like to create backup images (
.img
) stored in another machine.
1. Most volumes are LVM-Thin, and I cannot resize the volumes before creating the images. Then, how to keep the image files as small as possible?
1. Is dd
capable of creating a thin image of a volume?
1. In addition to dd
, which other tools can I use for this task?
TonyStacker
(1 rep)
Oct 14, 2024, 02:27 PM
1
votes
1
answers
1763
views
Can I rename a file inside an iso image without completely rebuilding it?
I have a bash script that is supposed to download a Windows 10 iso file from Microsoft and then change the names of two files in that iso in order to remove the "Press any key to boot from this CD/DVD..." prompt. Essentially I just want to swap the file names of these two files: [
cdboot.efi
becomes cdboot_noprompt.efi
.
And cdboot_noprompt.efi
becomes cdboot.efi
.
I know I could mount the image, copy the the contents somewhere, modify it to my liking and then use mkisofs
/genisoimage
to create a new iso, somewhat like this:
sudo mount -o loop -t iso9660 /path/to/windows.iso /mnt
sudo cp /mnt/ /mnt_copy/
cd /mnt_copy/efi/microsoft/boot
sudo mv cdboot.efi tmp.efi
sudo mv cdboot_noprompt.efi cdboot.efi
sudo mv tmp.efi cdboot_noprompt.efi
sudo genisoimage -J -joliet-long -r -allow-lowercase -allow-multidot -o "/path/to/new/windows.iso" "/mnt_copy/"
# And then magically make the iso bootable again. No idea how this would be done.
but I'd like to avoid all this unnecessary overhead.
Forivin
(1193 rep)
Jul 18, 2019, 09:50 AM
• Last activity: Oct 7, 2024, 02:28 PM
0
votes
1
answers
88
views
SDcard Image behaves differently than Original
I created my OS on my Raspberry pi 2 zero W on an SDcard. Now I want to distribute it so I made an Image from the SDCard (using dd). But the two cards behave differently especially at startup. Did this happen to you before? is there a better way to make an identical copy?
I created my OS on my Raspberry pi 2 zero W on an SDcard. Now I want to distribute it so I made an Image from the SDCard (using dd). But the two cards behave differently especially at startup. Did this happen to you before? is there a better way to make an identical copy?
Jestern Alberto Novello
(1 rep)
Sep 11, 2024, 02:00 PM
• Last activity: Sep 11, 2024, 03:32 PM
1
votes
2
answers
1263
views
How do I image a LUKS system disk with Clonezilla without including all the empty space?
I have a 1 TB NVMe disk with Ubuntu 22 installed with vanilla options, except I used LVM, and enabled LUKS. I'd like to image the disk for easy restores. Simply backing up the files is not enough for me, because I also want to revert partition/LVM information when restoring. However, I don't want to...
I have a 1 TB NVMe disk with Ubuntu 22 installed with vanilla options, except I used LVM, and enabled LUKS. I'd like to image the disk for easy restores. Simply backing up the files is not enough for me, because I also want to revert partition/LVM information when restoring. However, I don't want to end up with a 1 TB image file that is 95% empty space.
How do I get Clonezilla to do this? I can unlock/mount the encrypted volumes, and image them, but that doesn't maintain the underlying partition structure. If I image the underlying partitions, it images the LUKS partitions like they're just a 900ish GB slab of binary.
What's a workaround here?
Duncan Marshall
(651 rep)
Jan 14, 2024, 10:01 AM
• Last activity: Sep 8, 2024, 09:43 AM
2
votes
1
answers
233
views
Is it possible to chainload a disk-image file from Grub with the chainloader entry?
I have a disk image that is meant to be flashed and run as a live-USB. Is it possible to boot from this image in Grub in a similar way to booting from an ISO with `chainloader+1` ? How would the menu entry in grub look, for example?
I have a disk image that is meant to be flashed and run as a live-USB.
Is it possible to boot from this image in Grub in a similar way to booting from an ISO with
chainloader+1
?
How would the menu entry in grub look, for example?
dfasklj dsglkj
(21 rep)
Feb 29, 2020, 11:14 PM
• Last activity: Sep 6, 2024, 03:59 PM
0
votes
1
answers
386
views
Resize Disk Image with Protective MBR and GPT table
I've got a disk image that I need shortened slightly (long story - but it deals with variances in flash drive sizes). The partitions are *already* short enough, but the drive size is not. Basically, I have a disk image that is 15678308352 bytes (30621696 sectors). I'm wanting to reduce the disk imag...
I've got a disk image that I need shortened slightly (long story - but it deals with variances in flash drive sizes). The partitions are *already* short enough, but the drive size is not.
Basically, I have a disk image that is 15678308352 bytes (30621696 sectors). I'm wanting to reduce the disk image size to 15678292992 bytes (30621666 sectors). The last sector being used by any "real" partition is 30621662 (I'm fine ending there, too, but I padded it by 4 sectors just to be safe). In any case, I'm wanting to resize the partition tables, but I don't really know how, especially since the GPT table is inside a "protected MBR".
Here's the output of fdisk showing the protected MBR:
fdisk mydisk.img
Disk: mydisk.img geometry: 1906/255/63 [30621696 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 0 0 2 - 1023 255 63 [ 1 - 30621695]
2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Here's the output of gdisk showing the GPT info:
GPT fdisk (gdisk) version 1.0.10
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk mydisk.img: 30621696 sectors, 14.6 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): BD99B4B8-8070-0648-AEA4-B28BCD949EB7
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 30621662
Partitions will be aligned on 2048-sector boundaries
Total free space is 18398 sectors (9.0 MiB)
Number Start (sector) End (sector) Size Code Name
1 8192 249855 118.0 MiB 8300 primary
2 260096 30621662 14.5 GiB 8300 primary
As you can see, I have plenty of room to shrink the disk but I just don't know how.
I tried manually editing the MBR partition size in hexedit, but then I got all sorts of warnings on the GPT partition.
Any ideas?
johnnyb
(101 rep)
Jul 10, 2024, 05:02 PM
• Last activity: Aug 5, 2024, 07:54 PM
Showing page 1 of 20 total questions