Can I write to the USB stick that I'm running Ubuntu from?

Solution 1:

You can remount in read-write mode the partition mounted on /cdrom with the following command:

sudo mount -o remount,rw /cdrom

Solution 2:

I have tried to write to my cdrom drive but it requires root permission, which is not really practical as every time I need to write to the folder its mounted to, I have to use sudo/gksu.

After some researching to make the cdrom folder writeable, I realized that the problem here is simple. Data need to be easily shared (both read and write) on both Windows and Ubuntu. So I have changed my approach and use following technique.

  1. Use GParted to have following partition layout on my 8GB USB stick:

    • [ Primary 4GB fat32 label Data flag lba ]
    • [ Logical 710MB fat32 label LiveUSB flag boot/lba ]
    • [ Logical 3.29GB ext4 label casper-rw ] ]

    After I created all partitions, I had to unplug and re-plug the stick so that Ubuntu would remount all partition. I am not sure about the lba flag but I keep it just to be in safer side.

  2. Use usb-creator to put Live USB to 2nd partition which is labeled LiveUSB. I also followed the instructions here and added the word persistent after append in order for the stick to become a real Live USB device.

After booting from the newly created Live USB stick, a mount point Data show up, and I can write to that easily. After booting Windows and putting in the USB stick, I also have a drive labeled Data for me to write to. This fitted my need.

Solution 3:

Yes. If you want to, you can make your USB-stick persistent when you create it, which allows you to save settings and save files within Ubuntu. If you are looking to be able to access the files you write to the stick, while NOT running from the stick, you'll need to partition the stick.

More information on both can be found at https://wiki.ubuntu.com/LiveUsbPendrivePersistent