How can I copy files from/to USB drive containg a running live distro?
When I run a live distro from a USB drive, I want to access the USB key's file system to, for example, get files and copy to the USB drive, or copy files from the USB key to another filesystem.
Is this possible? Any help is appreciated.
Solution 1:
Remount cdrom
to get write access to /cdrom
+1 to @MihaiRotaru's comment,
sudo mount -o remount,rw /cdrom
Remounting works, but root
will own /cdrom
and its content. This means that it will work to write with sudo
.
Explanation and discussion
-
Here we are talking about a live (live-only) Ubuntu or Ubuntu family flavour that is extracted from an iso file into a FAT32 file system in a partition in a USB pendrive or memory card. This method is used by Rufus and Unetbootin. You can make it yourself according to this link.
- In a live-only drive with an Ubuntu family system,
/cdrom
is mounted read-only but can be remounted read-write. - In a persistent live Ubuntu family system,
cdrom
is mounted read-write, but there should also be acasper-rw
file or partition, where it is more straight-forward to write (simply write in the home directory tree and it will be stored automatically).
- In a live-only drive with an Ubuntu family system,
-
A live system can also be created by cloning from an iso file onto the device of a USB pendrive or memory card. This method is used by the Ubuntu Startup Disk Creator and Disks and mkusb in Ubuntu and by Win32 Disk Imager (and Rufus in 'dd-mode') in Windows.
- The cloned file system ISO 9660 is read-only by design and you cannot store anything in it.
You can create a partition 'behind' the cloned part and use the unallocated drive space for a partition, where you can store data.
If the Ubuntu version is 19.10 or newer and
- if the partition has an
ext2
,ext3
orext4
file system and -
if the partition has the label
casper-rw
it will be a persistent live system, where stored data, tweaks and installed programs will persist shutdown and reboot. This is described in this link.