How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Moderator: BarryK

Post Reply
Thanos
Posts: 92
Joined: Wed Mar 29, 2023 6:02 am
Has thanked: 3 times
Been thanked: 14 times

How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by Thanos »

I have a 8GB usb stick with easyos on it, but I used the space only 2GB .

Now, I want to backup the usb stick into a img file.

When I use the command line "dd if=/dev/sda of=myeasy.img", I get a 8GB file, it is too big for me.

So, how to make a small image only 2GB?

User avatar
BarryK
Posts: 2692
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: How to make a 2 GB .img backup file from EasyOS on an 8 GB stick?

Post by BarryK »

8GB is the minimum size that is usable.

If you really want to make it smaller, you would have to reduce the size of the working-partition, using gparted.

Then, knowing how much space is required, which is, on the usb-stick:
1MiB gap + 7MiB esp boot partition + size of ext4 working-partition + 1MiB safety gap on end

Well, say that is 2GiB, 2048MiB, then you would do this:

Code: Select all

# dd if=/dev/sda of=easy.img bs=1M count=2048
# sync
Thanos
Posts: 92
Joined: Wed Mar 29, 2023 6:02 am
Has thanked: 3 times
Been thanked: 14 times

Re: How to make a 2 GB .img backup file from EasyOS on an 8 GB stick?

Post by Thanos »

After I got the 2GB image file, can I extend the image file to 3GB with some commands? I want to add some files to the easy2 partition.

User avatar
BarryK
Posts: 2692
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: How to make a 2 GB .img backup file from EasyOS on an 8 GB stick?

Post by BarryK »

Thanos wrote: Wed Jan 31, 2024 10:37 pm

After I got the 2GB image file, can I extend the image file to 3GB with some commands? I want to add some files to the easy2 partition.

The easiest way would be to create a 3GB img file in the first place.

Thanos
Posts: 92
Joined: Wed Mar 29, 2023 6:02 am
Has thanked: 3 times
Been thanked: 14 times

Re: How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by Thanos »

No way to edit the img file?

I want to mount the img file and edit it.

User avatar
BarryK
Posts: 2692
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by BarryK »

It is possible to edit the .img file and increase its size. A few steps involved, cannot give them off the top of my head.

The easiest way would be to write the .img file to a usb stick, run gparted to increase the size of the ext4 partition, then use dd to copy it back to an .img file.

If you want to study how to operate directly on a .img file, see this:

https://github.com/bkauler/woofq/blob/m ... el-drv-img

schip
Posts: 9
Joined: Tue Jun 04, 2024 2:48 am

Re: How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by schip »

Im getting a page not found on this link,

want to learn more about IMG file creation - why linux distributions are using ISOs on machines without DVDs seems so backward.

jamesbond
Posts: 717
Joined: Tue Aug 11, 2020 3:02 pm
Location: The Pale Blue Dot
Has thanked: 124 times
Been thanked: 402 times

Re: How to make a 2 GB .img backup file from EasyOS on an 8 GB stick?

Post by jamesbond »

Thanos wrote: Wed Jan 31, 2024 10:37 pm

After I got the 2GB image file, can I extend the image file to 3GB with some commands? I want to add some files to the easy2 partition.

Everything in done in terminal.
1. Run truncate -s 3G easyos.img. "3G" means "3 GB", and you can change it to 4G, 5G whatever you want, but you need to make sure that it is __LARGER__ than the current size of easyos.img. Otherwise, the image file will be damaged.
2. Run losetup -f. You will get something like /dev/loop2, this is the "loop device" that you're going to use for later steps.
3. Run losetup -f -P easyos.img. This will mount the image file to the loop device you get from (1).
4. Run gparted /dev/loop2 (replace /dev/loop2 with what you get from (1)). Use gparted to re-size as needed.
5. When done, run losetup -d /dev/loop2 (replace /dev/loop2 with what you get from (1)).

If at any time you get an error, stop and don't proceed.

Good luck.

User avatar
rockedge
Site Admin
Posts: 6546
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2749 times
Been thanked: 2626 times
Contact:

Re: How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by rockedge »

schip wrote: Thu Jun 06, 2024 5:14 am

want to learn more about IMG file creation - why linux distributions are using ISOs on machines without DVDs seems so backward.

An iso file is an image (img) file with the iso9660 file system. In other words, iso files are a subset of image files. As a matter of fact, most iso files are synthetic images, not created by making images of drives, but typically made in order to create boot drives in DVD disks, USB pendrives or memory cards.

you can replace the extension iso with img.

Code: Select all

 mv file.iso file.img

This works well, but be careful using dd

Code: Select all

dd if=/home/your.iso of=/home/your.img

Converting from .img to .iso may or may not work because .img might not be in a iso9660 file system structure which makes up an ISO.

schip
Posts: 9
Joined: Tue Jun 04, 2024 2:48 am

Re: How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by schip »

Ta chaps !! ..this is excellent reading.

Im familiar with .IMG files from Mac PCs and do recall there being issues with a change of file type.
I found the file space size limitation with my first experiences with Haiku booted from USB stick...but on a more recent visit found they have a away around that (though I need to do it again to get the idea better in my head.)

..and yep got a recent reminder of the dangers of using dd when I wiped out the external SSD I use for booting MX linux on a old iMac...instead of installing an ISO onto a USB stick. (luckily the file content was mainly )a back up of the internal HD.)

Im interested in using .IMG instead of ISO with other linux distributions ..perhaps even on Mac PPC based machines which are bit of a trick to boot from a usb stick..but not impossible..with recent findings on Macrumors.

One tricky one Ive been struggling with recently is Damn Small Linux..USB makers in Haiku and other linux distros put up an error message about the ISO not having a file system. But this must be working for others as Ive not found any mention of it as a problem.

Thanks for your input guys..I have more reading and playing to do.

Clarity
Posts: 3829
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1628 times
Been thanked: 523 times

Re: How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by Clarity »

Hello @schip I hope this makes sense. Despite the fervor of ISO and IMG, these are "nothing more" than shipping containers. ISOs as a container has emerged to be useful in creating bootable media other than merely CD/DVDs. As such, is a bit more universal than IMG files.

This is NO different from some shippers preferring boxes while others prefer plastic/paper type shipping bags.

Each of these are merely containers and the tools we used to open/use/redirect their contents may differ. Some tools can open to handle either of these containers; as is done by Ventoy or "dd' or others, for example.

Again, its a preference by the shipper who decide which "container" to release their distro for use/installation. ... nothing more.

HarveyH
Posts: 96
Joined: Wed Oct 18, 2023 8:40 pm
Been thanked: 21 times

Re: How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by HarveyH »

schip wrote: Thu Jun 06, 2024 5:14 am

Im getting a page not found on this link,

want to learn more about IMG file creation - why linux distributions are using ISOs on machines without DVDs seems so backward.

Wild guess: Because ISO (like ZIP), although old, is the universal standard and is automatically write-protected. An IMG file can be written to and ruined. Also, an img file pretty much HAS to be burned to a flash drive; even if all you want to do is look at the OS or play with it. I'll take a live CD/DVD ISO over an IMG any time.

HarveyH
Posts: 96
Joined: Wed Oct 18, 2023 8:40 pm
Been thanked: 21 times

Re: How to make a 2 GB .img backup file from EasyOS on an 8 GB stick?

Post by HarveyH »

jamesbond wrote: Thu Jun 06, 2024 7:15 am

Everything in done in terminal.
1. Run truncate -s 3G easyos.img. "3G" means "3 GB", and you can change it to 4G, 5G whatever you want, but you need to make sure that it is __LARGER__ than the current size of easyos.img. Otherwise, the image file will be damaged.

stuff stuff stuff

Original post removed and this put in it's place:

After trying this very slowly and carefully three times, I still had three fails. Every single time, the new EasyOS img file failed to boot with many errors saying it couldn't find etc/fstab.

schip
Posts: 9
Joined: Tue Jun 04, 2024 2:48 am

Re: How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by schip »

This thread started with increasing the size of IMG..and we're looking at other factors and sharing knowledge but there's another layer here than img vs iso comparisons.

I'm interested in giving longer life to wot industry considers or prefers to be 'obsolete' computers. And if a system can be installed that's up to date as this year or even today..and it is useable then I consider that a success.

Admittedly I'm not talking high demand use but just those every day things - email, text, web maybe a movie.

Getting a newer system onto a machine not really made for it is ..well let's say a computer game.

So though iso or img is the means (or container) it doesn't matter as long as it's easy to do for a novice and it works. (Definition pending.)

And I'm talking multi hardware types here - atom processor or PPC Mac.
So the atom (emachine) lacks a cd/DVDs drive and the PPC can write CDs 700 MB but not DVDS..so there's an iso size factor...but also a USB boot factor..not a built in feature but still do able.

I'm looking for easy ways to make things work (I'm not smart enough for the real tricky stuff)
The IMG factor is maybe a way I've not explored truely before..but seeing how it can be made to work in easyos is a great revelation to me..especially as it sorts that storage space on a iso USB stick factor.

OOPS - sorry guys -.im raving here !!

Long story short (too late) I've got exploring to do re IMG as a possible better way
..so thank you (once again) for your input and guidance.

schip
Posts: 9
Joined: Tue Jun 04, 2024 2:48 am

Re: How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by schip »

Maybe the really important factor isn't so much if its ISOLATED or IMG ?
But the use of Ventoy as a boot loader..as it will do both ISO or IMG..from wot I just read here in the Haiku-is discussions:

https://discuss.haiku-os.org/t/how-abou ... aiku/13281

..and it seems which OS caters for Ventoy..as listed in

https://github.com/ventoy/Ventoy/tree/m ... entoy/hook

I see Fatdog is listed there.

schip
Posts: 9
Joined: Tue Jun 04, 2024 2:48 am

Re: How to make a 2 GB .img backup file, from EasyOS on an 8 GB stick?

Post by schip »

..oops oops ISO ..not isolated. Grrr !!

Post Reply

Return to “EasyOS”