msacco
Posts: 25
Joined: Fri May 22, 2020 10:19 am

Can you paste files onto the raspberry pi instead of flashing them?

Sun May 24, 2020 11:33 pm

Hope it's the right place to ask, something I'm wondering about, when you flash an OS onto an sd card(or whatever is it that you're using) it already creates everything for you which is: partitions, files, settings, etc.

I'm wondering if it's possible to manually get all the needed files, manually create all the necessary partittions according to the OS, and then set all the configurations manually to make it work?

If it is possible to do that, can someone please share what are the required steps to do this?

Thanks :)

bls
Posts: 728
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA
Contact: Twitter

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 12:18 am

Could you explain a bit what problem you're trying to solve or what goal you're trying to achieve?
Pi tools:
Free your network from your router's DHCP/DNS and run it on a Pi:https://github.com/gitbls/ndm
Quickly and easily build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

msacco
Posts: 25
Joined: Fri May 22, 2020 10:19 am

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 12:37 am

bls wrote:
Mon May 25, 2020 12:18 am
Could you explain a bit what problem you're trying to solve or what goal you're trying to achieve?
Well, in general I'm trying to make some modifications to partitions in my current OS.

As part of that I'm trying to understand whether I could simply paste the needed files on a partition instead of having to flash it.

It's more of a general question and not a thread going in depth about my actual "issues".

Thanks :)

User avatar
davidcoton
Posts: 5169
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 12:41 am

OK, some general answers.
Yes it is possible to set up an SDCard the hard way.
No I do not have a recipe, because it's more trouble than it's worth. Even if you have particular needs/wishes/problems, there are almost certainly easier solutions.

EDIT: typo
Last edited by davidcoton on Mon May 25, 2020 12:48 am, edited 1 time in total.
Location: 345th cell on the right of the 210th row of L2 cache

bls
Posts: 728
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA
Contact: Twitter

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 12:46 am

Yes, you could do it that way. But there are other, much easier ways to muck with partitions and installations.
Pi tools:
Free your network from your router's DHCP/DNS and run it on a Pi:https://github.com/gitbls/ndm
Quickly and easily build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

User avatar
HawaiianPi
Posts: 5955
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 1:53 am

My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

msacco
Posts: 25
Joined: Fri May 22, 2020 10:19 am

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 3:19 am

Thanks for the comments, that's very useful!

If for example I have some partition, I'm backing up all the files in there, deleting it and then recreating that same partition and pasting the original files, after modifying the cmdline/fstab accordingly, should it work?

Thanks.

Heater
Posts: 16319
Joined: Tue Jul 17, 2012 3:02 pm

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 3:57 am

msacco wrote:
Mon May 25, 2020 3:19 am
Thanks for the comments, that's very useful!

If for example I have some partition, I'm backing up all the files in there, deleting it and then recreating that same partition and pasting the original files, after modifying the cmdline/fstab accordingly, should it work?

Thanks.
If you want to mess with the partitions and files on your SD like that the best thing to do is to set yourself up with a Linux PC/laptop. Then you will be able to easily read/write files on the partitions which Windows cannot see. You will have the tools to easily create/delete/modify partitions etc.

The most likely result is that you will wast countless hours trying to get such a mucked up system working properly.

Which is not to say you should not try, it's a great way to learn how a Linux system is put together.
Memory in C++ is a leaky abstraction .

Moonmarch
Posts: 498
Joined: Thu Mar 07, 2019 1:34 am

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 6:23 am

You can access the entire operating system file system in Raspbian if you use the sudo command in the terminal. Actually I don't know if you use either the sudo or su command, both commands have the same function. To have root access to the entire OS, use the command in the terminal, sudo su. You would then be able to add or remove files from any directory in the file system, to any directory in the file system. The sudo command is useful for accessing files that are not in the home directory. Accessing the /home directory does not require elevated privileges in comparison to accessing let's say the /usr directory. To see if you can access a directory in the OS, try creating a new folder in the directory. If you are unable to create the folder, that means you do not have user privileges to modify the contents of the directory. To add the folder in the directory, you need to use the sudo command in the terminal. For example:

Code: Select all

cd /usr

Code: Select all

sudo mkdir ABC123
Access the /usr directory, you will see the new directory you created after using the sudo mkdir command. After modifying all of the files on the OS, you can then copy the SD card to any external storage drive connected to the RPI computer. External storage can include USB drives, SD card to USB adapter, SATA to USB adapter, etc. You can use the SD card copier or the dd command in the terminal to clone the OS on the external storage drive. You can use the Raspberry Pi Imager tool to flash OS images to a SD card or other computer storage drive.

msacco
Posts: 25
Joined: Fri May 22, 2020 10:19 am

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 7:44 am

Heater wrote:
Mon May 25, 2020 3:57 am
msacco wrote:
Mon May 25, 2020 3:19 am
Thanks for the comments, that's very useful!

If for example I have some partition, I'm backing up all the files in there, deleting it and then recreating that same partition and pasting the original files, after modifying the cmdline/fstab accordingly, should it work?

Thanks.
If you want to mess with the partitions and files on your SD like that the best thing to do is to set yourself up with a Linux PC/laptop. Then you will be able to easily read/write files on the partitions which Windows cannot see. You will have the tools to easily create/delete/modify partitions etc.

The most likely result is that you will wast countless hours trying to get such a mucked up system working properly.

Which is not to say you should not try, it's a great way to learn how a Linux system is put together.
Yeah I'm already using a linux laptop to do all of that :)
Moonmarch wrote:
Mon May 25, 2020 6:23 am
You can access the entire operating system file system in Raspbian if you use the sudo command in the terminal. Actually I don't know if you use either the sudo or su command, both commands have the same function. To have root access to the entire OS, use the command in the terminal, sudo su. You would then be able to add or remove files from any directory in the file system, to any directory in the file system. The sudo command is useful for accessing files that are not in the home directory. Accessing the /home directory does not require elevated privileges in comparison to accessing let's say the /usr directory. To see if you can access a directory in the OS, try creating a new folder in the directory. If you are unable to create the folder, that means you do not have user privileges to modify the contents of the directory. To add the folder in the directory, you need to use the sudo command in the terminal. For example:

Code: Select all

cd /usr

Code: Select all

sudo mkdir ABC123
Access the /usr directory, you will see the new directory you created after using the sudo mkdir command. After modifying all of the files on the OS, you can then copy the SD card to any external storage drive connected to the RPI computer. External storage can include USB drives, SD card to USB adapter, SATA to USB adapter, etc. You can use the SD card copier or the dd command in the terminal to clone the OS on the external storage drive. You can use the Raspberry Pi Imager tool to flash OS images to a SD card or other computer storage drive.
Thanks, the only relevant part of your comment was the last sentence as I already knew the rest, but thanks ^^

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26864
Joined: Sat Jul 30, 2011 7:41 pm

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 7:47 am

Moonmarch wrote:
Mon May 25, 2020 6:23 am
You can access the entire operating system file system in Raspbian if you use the sudo command in the terminal. Actually I don't know if you use either the sudo or su command, both commands have the same function. To have root access to the entire OS, use the command in the terminal, sudo su. You would then be able to add or remove files from any directory in the file system, to any directory in the file system. The sudo command is useful for accessing files that are not in the home directory. Accessing the /home directory does not require elevated privileges in comparison to accessing let's say the /usr directory. To see if you can access a directory in the OS, try creating a new folder in the directory. If you are unable to create the folder, that means you do not have user privileges to modify the contents of the directory. To add the folder in the directory, you need to use the sudo command in the terminal. For example:

Code: Select all

cd /usr

Code: Select all

sudo mkdir ABC123
Access the /usr directory, you will see the new directory you created after using the sudo mkdir command. After modifying all of the files on the OS, you can then copy the SD card to any external storage drive connected to the RPI computer. External storage can include USB drives, SD card to USB adapter, SATA to USB adapter, etc. You can use the SD card copier or the dd command in the terminal to clone the OS on the external storage drive. You can use the Raspberry Pi Imager tool to flash OS images to a SD card or other computer storage drive.
Does this have anything to do with the question asked?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

sparkyhall
Posts: 168
Joined: Mon Aug 27, 2012 9:14 am

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 7:51 am

msacco wrote:
Mon May 25, 2020 3:19 am

If for example I have some partition, I'm backing up all the files in there, deleting it and then recreating that same partition and pasting the original files, after modifying the cmdline/fstab accordingly, should it work?

Thanks.
Yes, providing you maintain the correct file attributes such as ownership, permissions, execute flags etc.

You can keep the existing file attributes by either copying, as root, to another linux file system or by using tar or zip. Copying directly to something like fat32 will loose the attributes.

For example, to do this with rsync I use the following:

Code: Select all

rsync -vaHAX /path-to-source-files/ /path-to-destination/
Clearly its wise to create backups before doing any of this.

msacco
Posts: 25
Joined: Fri May 22, 2020 10:19 am

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 8:35 am

sparkyhall wrote:
Mon May 25, 2020 7:51 am
msacco wrote:
Mon May 25, 2020 3:19 am

If for example I have some partition, I'm backing up all the files in there, deleting it and then recreating that same partition and pasting the original files, after modifying the cmdline/fstab accordingly, should it work?

Thanks.
Yes, providing you maintain the correct file attributes such as ownership, permissions, execute flags etc.

You can keep the existing file attributes by either copying, as root, to another linux file system or by using tar or zip. Copying directly to something like fat32 will loose the attributes.

For example, to do this with rsync I use the following:

Code: Select all

rsync -vaHAX /path-to-source-files/ /path-to-destination/
Clearly its wise to create backups before doing any of this.
Thanks! I already have backups of the whole system so I'm really just trying to experiment and do whatever without worrying about anything being lost.
I'll try that right now :)

msacco
Posts: 25
Joined: Fri May 22, 2020 10:19 am

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 2:50 pm

So latest solution using rsync worked with a raspbian distro, but failed with the OS I'm using(which is debian based btw!)
I actually think it would've worked even with a regular copy/paste, not sure why it doesn't work on the other system, probably because the partitions are kinda messed up.

Moonmarch
Posts: 498
Joined: Thu Mar 07, 2019 1:34 am

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 5:17 pm

If the storage drive is not the formatted to the file type supported by the OS, then the computer will not boot. If you modify the contents of the OS while the OS is running, then you should not have boot problems. My idea was testing out the modified OS before copying, and pasting, or cloning all of the data on the main SD card to other SD cards. I had to use Ubuntu before in the past, and Ubuntu required a password for everything. Eventually I was able to use Ubuntu after reading reading several guides. At the time I only used certain number of programs, the computer was not intended for me to use either. This was only temporary, I found the missing Windows key for the PC, and installed Windows all over again.

The reason why people need a large number of clones of a operating system. The OS is intended to be installed on a large number of computers. Instead of installing software manually on each computer, you can instead clone the OS. I don't know if you can proceed with using the same instructions with Windows. A Windows PC can consist of several different computer components. Which means the computer will not boot if the OS was not installed correctly. Transferring a SD card used on a RPI4 to a different RPI4 computer, you should not have any compatibility problems.

Heater
Posts: 16319
Joined: Tue Jul 17, 2012 3:02 pm

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 6:03 pm

I wish any of that made any sense at all Moonarch.

If one wants to create partitions on SD cards and such for Linux file systems one is going to have to learn how to use tools like parted, gparted, fdisk etc.

If you are keen on learning about all these nitty gritty guts of a Linux OS have a read of Linux From Scratch on the Raspberry Pi
https://intestinate.com/pilfs/
Memory in C++ is a leaky abstraction .

msacco
Posts: 25
Joined: Fri May 22, 2020 10:19 am

Re: Can you paste files onto the raspberry pi instead of flashing them?

Mon May 25, 2020 9:25 pm

So I've been kinda dumb, mounting the incorrect partition as the root partition from the cmdline, even though I did try mounting each partition I've had, but maybe I've missed something.

I've usually did multiple partition changes at once, so this time I took it more easily and checked any small change I've made which was easier to follow up and get it working.

Thanks.

Return to “General discussion”