English | Lietuviškai

Info


Communication


PEROPESIS FORUM

This forum is dedicated to discussing issues related to the use and development of the Peropesis Linux operating system.

Saving text files to USB drive

by minimalist, Tuesday, September 19, 2023, 02:50 (312 days ago)

Hi,I really like Peropesis! I am booting from a USB drive and want to save my own .bashrc file and some other text files to this USB drive. I tried mounting this USB drive and it says it is already mounted. I can copy a file to /mnt/sdb1, but after rebooting it is no longer there. What am I missing?

Saving text files to USB drive

by g, Tuesday, September 19, 2023, 13:06 (312 days ago) @ minimalist

Hello,

I like Peropesis too, it has a lot of problems, but it is already available for using in certain aspects. :) For the mounting I have questions: do you want to copy the file you created to a USB drive for transport or do you want to write the file you created to Peropesis file system, so achieving to make changes in this system?

Saving text files to USB drive

by minimalist, Tuesday, September 19, 2023, 17:10 (312 days ago) @ g

Hi, I want to save to the USB drive that boots peropesis and add .bashrc, .bash_aliases and .bash_function files to the $HOME directory.

Saving text files to USB->ISO->rootfs

by g, Wednesday, September 20, 2023, 17:22 (311 days ago) @ minimalist
edited by g, Wednesday, September 20, 2023, 18:18

As I understand, you mounted the USB device (the sdb1 partition) in the Peropesis filesystem, where the Peropesis-*-live.iso image was written. What you mounted should be an ISO file system. This system is a read-only file system. This means that it is not possible to write data to it.


As far as I understand, the files you create can only be saved to another/new built-in USB device, that has been previously formatted to the FAT32 file system.


But if you just want your newly created '.bashrc' file could work in the Peropesis filesystem, without reloading it first, this can be done by executing the bash program with --rcfile option. Example:
# bash --rcfile .bashrc


As you know, everything you created in the Peropesis file system disappears when you restart your computer. The only way to save is to copy these files to other media or send them somewhere using the internet.


If you still want to save your created files to Peropesis, which is on a USB drive, you should do it like this:


1. Mount the Peropesis-*-.iso to the file system (as I understood you did it in the /mnt directory). Example:
# mount /dev/sdb1 /mnt


2. Copy the contents of the /mnt directory to the newly created directory, eg /root/iso. Example:
# mkdir /root/iso
# cp -dpR /mnt/* /root/iso


3. Move the archived root file system from the directory /root/iso/images to the new directory fs. Example:
# mkdir /root/fs
# mv /root/iso/images/rootfs.xz /root/fs


4. Extract the rootfs.xz filesystem. Example:
# cd /root/fs
# xz -dc < rootfs.xz | cpio -idmv | rm rootfs.xz


Note. Since Peropesis is a super small system, there is no cpio archiver program in it. Cpio can be downloaded and installed. Example:
# wget https://ftp.gnu.org/gnu/cpio/cpio-2.14.tar.bz2 #(or by using browser links)
# tar -xvf cpio*
# cd cpio-2.14
# ./configure --prefix=/usr
# make
# make install

Something like that... Check is 'cpio' exist:
$ cpio --version


5. After unzipping roofs.xz, you should see the file system "/bin /boot /dev etc..." in the "fs" directory. Example:
# ls /root/fs


6. It is now possible to upload newly created files such as .bashrc to the file system. Example:
# cp -dpR .bashrc /root/fs/root


7. The newly prepared file system needs to be archived again. Example:
# cd /root/fs
# find . | cpio -R root:root -H newc -o | xz -9 --check=none > ../rootfs.xz


8. The archived file system needs to be moved to the /root/iso/images directory. Example:
# mv /root/rootfs.xz /root/iso/images


9. Next you need to create a new ISO image. Example:
# cd /root/iso
# export ISO=/root/iso
# mkisofs -z -R -l --allow-leading-dots -D -o \
../Peropesis2.iso -b isolinux/isolinux.bin \
-c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
-V "Peropesis-2.2-live" $ISO


Note. Since Peropesis is a small system, "mkisofs" program is still not included in it. "mkisofs" is part of the "cdrtools" software package. This sowtware has open source, so like cpio it can be downloaded and installed. Example:
# wget https://downloads.sourceforge.net/cdrtools/cdrtools-3.02a09.tar.bz2
# tar -xvf cdrtools-3.02a09.tar.bz2
# cd cdrtools-3.02
# make
# make INS_BASE=/usr install

Check is 'mkisofs' exist:
# mkisofs --version


10. If everything is fine, then you need to burn your newly created personal ISO to a new USB device and use it. Example:
# dd if=Peropesis2.iso of=/dev/sdx


If you haven't used it yet, I recommend using screen multiplier for making new filesystem and ISO. In this way, the screen can be divided into several windows, so it is much more convenient to work, especially when copying commands, for example from this post. Manual about it: https://peropesis.org/user-manual/#screen-manager-screen


For simplicity, all commands were executed with root privileges. I hope your question was about that.


Copyright © 2021-2024 Peropesis. See license terms.
E-mail: info(at)peropesis.org