I have a 16G pendrive that has some bad blocks:# f3read /media/morfik/224e0447-1b26-4c3e-a691-5bf1db650d21                  SECTORS      ok/corrupted/changed/overwrittenValidating file 1.h2w ... 2097112/       40/      0/      0Validating file 2.h2w ... 2097120/       32/      0/      0Validating file 3.h2w ... 2097098/       54/      0/      0Validating file 4.h2w ... 2097148/        4/      0/      0Validating file 5.h2w ... 2097114/       38/      0/      0Validating file 6.h2w ... 2097152/        0/      0/      0Validating file 7.h2w ... 2097152/        0/      0/      0Validating file 8.h2w ... 2097152/        0/      0/      0Validating file 9.h2w ... 2097152/        0/      0/      0Validating file 10.h2w ... 2097152/        0/      0/      0Validating file 11.h2w ... 2097152/        0/      0/      0Validating file 12.h2w ... 2097152/        0/      0/      0Validating file 13.h2w ... 2097152/        0/      0/      0Validating file 14.h2w ... 2097152/        0/      0/      0Validating file 15.h2w ...   90664/        0/      0/      0  Data OK: 14.05 GB (29450624 sectors)Data LOST: 84.00 KB (168 sectors)             Corrupted: 84.00 KB (168 sectors)      Slightly changed: 0.00 Byte (0 sectors)           Overwritten: 0.00 Byte (0 sectors)Average reading speed: 18.77 MB/sAs you can see only the first five gigs have damaged sectors. The rest is fine. The problem is when I try to burn a live image to this pendrive, the action stops after transferring 50MiB.Is there a way to skip the 5G from the beginning and place the image after the damaged space, so it could boot without a problem?
Is it possible to burn a live image to a damaged pendrive?
usb drive;live usb;badblocks
I've managed to solve this problem, but I'm still wonder if there's a better and easier solution.Anyways, if you have bad blocks at the beginning of the device and you are unable to burn a live image, you should make two partitions: Then you download an image and check its first partition's offset:# parted  /home/morfik/Desktop/debian-live-8.1.0-amd64-mate-desktop.iso(parted) unit s(parted) printModel:  (file)Disk /home/morfik/Desktop/debian-live-8.1.0-amd64-mate-desktop.iso: 2015232sSector size (logical/physical): 512B/512BPartition Table: msdosDisk Flags:Number  Start  End       Size      Type     File system  Flags 1      64s    2015231s  2015168s  primary               boot, hiddenSo it's 64 sectors, which means 64*512=32768bytes . Now we are able to mount this image:# mount -o loop,offset=32768 /home/morfik/Desktop/debian-live-8.1.0-amd64-mate-desktop.iso /mnt mount: /dev/loop0 is write-protected, mounting read-only# ls -al /mnttotal 593Kdr-xr-xr-x  1 root root 2.0K 2015-06-06 16:09:57 ./drwxr-xr-x 24 root root 4.0K 2015-06-08 20:54:43 ../dr-xr-xr-x  1 root root 2.0K 2015-06-06 16:08:34 .disk/dr-xr-xr-x  1 root root 2.0K 2015-06-06 15:59:10 dists/dr-xr-xr-x  1 root root 2.0K 2015-06-06 16:09:41 install/dr-xr-xr-x  1 root root 2.0K 2015-06-06 16:08:29 isolinux/dr-xr-xr-x  1 root root 2.0K 2015-06-06 16:08:29 live/dr-xr-xr-x  1 root root 2.0K 2015-06-06 15:59:00 pool/dr-xr-xr-x  1 root root 2.0K 2015-06-06 16:09:37 tools/-r--r--r--  1 root root  133 2015-06-06 16:09:44 autorun.inflr-xr-xr-x  1 root root    1 2015-06-06 15:59:10 debian -> ./-r--r--r--  1 root root 177K 2015-06-06 16:09:44 g2ldr-r--r--r--  1 root root 8.0K 2015-06-06 16:09:44 g2ldr.mbr-r--r--r--  1 root root  28K 2015-06-06 16:09:57 md5sum.txt-r--r--r--  1 root root 360K 2015-06-06 16:09:44 setup.exe-r--r--r--  1 root root  228 2015-06-06 16:09:44 win32-loader.iniWe have access to the files so we can copy them to the prendrive's second partition:# cp -a /mnt/* /media/morfik/goodThe following command will hardcode the second partition into MBR in order to boot from it:printf '\x2' | cat /usr/lib/SYSLINUX/altmbr.bin - | dd bs=440 count=1 iflag=fullblock conv=notrunc of=/dev/sdbI'm using ext4 filesystem on the second partition, so I have to use extlinux, but the image has isolinux. I don't have to remove this folder, I can change its name instead:# mv isolinux extlinuxTha same thing I have to do with the config file inside of that folder:# mv isolinux.cfg extlinux.confI'm not sure whether this step is necessary, but I always copy all the files anyway:# cp /usr/lib/syslinux/modules/bios/* /media/morfik/good/extlinux/The last thing is to install extlinux's VBR on the second partition:# extlinux -i /media/morfik/good/extlinux//media/morfik/good/extlinux/ is device /dev/sdb2 And that's pretty much it. I tested the image, it boots and the live system works well. This solution should work for all kind of live images.