Created
June 6, 2018 09:24
-
-
Save b-luu/44eb8896e42abe6c81ed2f8804662562 to your computer and use it in GitHub Desktop.
How to make a live usb with persistance from the CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## First off, download a (any) distro's ISO/IMG (prefer torrent downloading for robustness...) | |
# from https://docs.fedoraproject.org/quick-docs/en-US/creating-and-using-a-live-installation-image.html | |
## Identify the name of the USB drive partition | |
lsblk -f | |
## Unmount all mounted partition from that device. This is very important, otherwise the written image might get corrupted. You can unmount all mounted partitions from the device with | |
sudo umount /dev/sdX* # where X is the appropriate letter, e.g. umount /dev/sdc*. | |
## Write the ISO file to the device | |
sudo dd if=/path/to/image.iso of=/dev/sdX bs=8M status=progress oflag=direct | |
# from https://medium.com/@fatahnuram/creating-kali-linux-live-usb-with-persistence-a-simple-guide-54e3eb01b6aa | |
## Make the unallocated space left in your USB flashdisk to become an ext4 filesystem, and label it with “persistence” | |
sudo fdisk /dev/sdX | |
# [n] [ENTER|p] [ENTER] [ENTER] [ENTER] [w] | |
# Note: If you get a warning about the partition table not being (re)read properly, you may want to unplug then replug your USB flashdrive to force the refresh of the partition table. | |
## Find the right partition | |
lsblk | |
#or | |
fdisk -l | |
## After the partition created, now we can make the filesystem inside that partition | |
sudo mkfs.ext4 -L persistence /dev/sdXY | |
## Note: The third step can also be done when you’re booting from your Linux Live USB. | |
## Next, the third step, we make that new partition into becoming really “persistence” storage | |
sudo mkdir /mnt/directory | |
sudo mount /dev/sdXY /mnt/directory | |
## Next the actual configuration | |
echo “/ union” > persistence.conf | |
sudo mv persistence.conf /mnt/directory | |
## Next we must unmount the persistent partition | |
sudo umount /dev/sdXY | |
## Afterword/verification: our “Linux with Persistence” is ready to use. Now you can boot your persistent linux by selecting the “Live USB with persistence” option at startup. | |
## Note: To tell whether your persistent storage is working or not, you can check in your Linux desktop: If the “persistence” partition is coming up in your desktop, we can tell that you failed to make the persistent storage. Otherwise, if the “persistence” storage doesn’t coming up, you’re ready to use the Linux with Persistence. |
Unfortunately, after following the instructions provided using a 16Gb USB, 428Mb for the system and 14Gb for persistence, while trying to follow on the command:
echo “/ union” > persistence.conf
I received the following error message:
bash: echo: write error: No space left on device
Can you help clarify and/or provide a way to correct the situation in order to continue the process.
In advance, for your time, help and consideration, I thank you with best wishes,
MVGarcia
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Persistance doesn't seem to be working properly (I need to try doing step 3 a boot time, because it seems a bit to automagic that mounting on another OS would just work on the Live USB...)
That being said, I can access the partition and write to it, so that solves my issue for now...
Other thing to dig into: if I install other packages or tools to the live OS would the initial size allocated from the direct copy be enough? (I doubt it...)