Does anybody know if there is a way to put a file (Stage_2.sys) on a virtual FAT32 HDD partition without using loopback devices (I tried them but they are only good for filesystem formatting and suck for everything else, especially writing files and build automation)? I need a tool of some sort that can do that (both adding and removing files ofc).
If you know a way I would be grateful to know.
(Solved) Putting files on Virtual HDDs
(Solved) Putting files on Virtual HDDs
Last edited by Octacone on Sun Dec 17, 2017 7:42 am, edited 1 time in total.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
(Solved) Putting files on Virtual HDDs
I know they exist but there is 0 information online.iansjack wrote:Mtools.
Cannot find a way to specify a partition of a virtual HDD...
I tried editing mtools config file and adding drive d: file="...HDD.img" partition=1, but no luck, partition not aligned, other errors etc... That is definitely not the right way of doing it...
This gives me, cannot initialize target, non dos media etc...
mcopy -i HDD.img Stage_2.sys ::/ (as you can see no way to specify a partition).
Edit:
Okay so I figured it out. To anybody in the future:
Put this inside your ~/.mtoolsrc
drive c: file="/path_to_your/HDD.img" partition=1 (1-4 are valid options) (the drive doesn't need to be labeled "c":)
mtools_skip_check=1
To copy a file to your virtual HDD partition use:
sudo mcopy Output/Stage_2.sys (your file) c: (your disk)
To delete a file from your virtual HDD partition use:
sudo mdel c:Stage_2.sys (your_drive:your_file)
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Re: (Solved) Putting files on Virtual HDDs
https://www.gnu.org/software/mtools/manual/mtools.htmlOctacone wrote:I know they exist but there is 0 information online.
Cheers,
Adam
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: (Solved) Putting files on Virtual HDDs
Writing files is easy, all you have to do is mount the partition:Octacone wrote:(I tried them but they are only good for filesystem formatting and suck for everything else, especially writing files and build automation)
Code: Select all
mount /dev/loop0p1 /mnt
cp file1 file2 file3 /mnt
umount /mnt