Tuesday, April 30, 2024
 Popular · Latest · Hot · Upcoming
14
rated 0 times [  14] [ 0]  / answers: 1 / hits: 3202  / 1 Year ago, sat, may 13, 2023, 3:59:33

I have an Ubuntu live USB and I don't have any other PC, laptop, or USB sticks. Can I make my live USB persistent? If not, is there any other way to save files in it so that they will stay there even after I restart my PC?


Note: I have a PC with an Intel 6th Gen Core i3 processor and 4GB RAM, and I'm currently running Ubuntu from a 16GB USB stick. I can't borrow others' computers or USB drives, but I do have a phone if that helps.


More From » live-usb

 Answers
4

Usually I recommend using mkusb in order to create a persistent live USB drive. But in this case I think it is too risky, because there is no backup, the only working operating system is in the target drive.


Instead I suggest to make the default /var/log and /var/crash mounted writable partition into a 'free' usbdata partition, that can be mounted and unmounted by the user.



  • When booting, at the grub menu, press 'e' to make a temporary edit: add nopersistent to the line starting with linux


    linux ... quiet splash nopersistent ---


  • continue booting with F10 or ctrl x



  • now you can unmount the partition with ext4 file system


    sudo umount /dev/sdx3

    where x is the drive letter (can be a, b, c ...)



  • change the label


    sudo tune2fs -L usbdata /dev/sdx3


  • shutdown, wait for 10 seconds and boot again.




The system will be live (not persistent live), but the ext4 partition can be used for storage. Until you have another drive available this is a rather safe method to create storage space on the drive. In order to make it convenient, you can create one or more directories at its top level and modify the ownership.


The partition will probably automount (it did when i tested with Lubuntu 20.04.4 LTS, which is lighter than standard Ubuntu).


cd /media/lubuntu/usbdata
sudo mkdir Docs
sudo chown 999 Docs

999 is the numeric ID of the live user (for standard Ubuntu as well as Lubuntu and the other community flavours). Now you can go there and test writing files.


cd Docs
echo 'Hello World' > hello
cat hello
ls -l hello

[#336] Saturday, May 13, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
olfdit

Total Points: 118
Total Questions: 98
Total Answers: 97

Location: Honduras
Member since Fri, Nov 25, 2022
1 Year ago
;