View previous topic :: View next topic |
Author |
Message |
dspahn Guru
Joined: 22 Jun 2006 Posts: 392
|
Posted: Thu Oct 15, 2015 6:14 am Post subject: How to transfer to bigger SD card? |
|
|
I'm installing Gentoo on a RPi2B... but it's on a 8gb card and I need more space (I havent even put X on yet!) If I get a 32GB card, how do I transfer the OS? Is it as simple as mounting /gentoo and /gentoo/boot, tarring the filesystem on another host machine, then putting in the new card, setting up the FS in cfdisk, mounting /gentoo and /gentoo/boot and untarring to that location? |
|
Back to top |
|
|
Irre Guru
Joined: 09 Nov 2013 Posts: 434 Location: Stockholm
|
Posted: Thu Oct 15, 2015 7:39 am Post subject: |
|
|
I think you should not expand your SD card.
In stead you should use an external USB-disk for everything but the boot-partition!
I use a 3Tb external disk. The SD-card need only the dos-partition and can even be removed (or serve other Raspberries) after boot!
I had several file system crashes before I moved the linux file system to an external (mechanical) disk. |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Thu Oct 15, 2015 8:33 am Post subject: |
|
|
I moved my gentoo installation several times recently.
Create new partiton layout by hand on the new harddisc
MAgic: cp -axr (you can use verbose flag v if you want but not needed) TAkes very long
Set up kernel / boot. Most of the time you ned to reinstall grub. When you changed hardware you need an adapted kernel
I found this way on the net. I dislike fsarchiver, rsync, or that rsyncbackup or what it is called. with cp command you get a duplicate, where you can swap in discs and it works. (tested on 3 notebooks because i moved the harddiscs below several times) SSDs are expensive and i do not get the point why not reuse a 50 euro drive (market value 50 euro, but a decent 128gb ssd probably costs 100 euros)
You can use tar also, but check out what cp -axr really does, you can for sure chain it with tar, but it makes things complicated. That was the main reason, to reduce complecity, and to have readable backup, to just use cp. |
|
Back to top |
|
|
snkmoorthy Guru
Joined: 19 Nov 2002 Posts: 376
|
Posted: Fri Oct 16, 2015 4:16 am Post subject: |
|
|
I usually use from the smaller to the bigger disk. use parted to resize the partition Quote: | resizepart <num> -1 | and run on that partition.
this ofcourse assumes that whatever free space you gain from 8GB -> 32GB, you want to keep it in the last ext2/3/4 partition. |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Fri Oct 16, 2015 11:57 am Post subject: |
|
|
dd is very bad. you assume the data is in a sane state on the drive.
you also rely that the structure of both "partitions", i like the lvm naming better of physical extents, are identical or the same.
these days we have 4k emulation, and different sector sizes.
i do not know why always that stupid dd is suggested. it does not reflect / consider data corruption / free disk space / data corruption and such... very bad idea.
cp command is far ahead of that, the setup of the new disc is not that hard. (when you do not have two sdcards slots, you could copy first to a ramdisc, and than use the ramdisc to copy to the next sdcard)
tar / rsync / rsyncbackpu / fsarchiver just add a layer which is not necessary...
one wrong hit with dd and data is overwritten, very very bad tool |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3444
|
Posted: Fri Oct 16, 2015 10:55 pm Post subject: |
|
|
dd and cp do exactly the same thing on different layers, what's so wrong with it?
Also, what's so wrong with rsync? It works as well as cp does and can even resume after it's interrupted.
What difference does 4k mapping do? It belongs in yet another layer.
If your filesystem is corrupted, what advantages cp have? It will fail. You must repair filesystem and then retry. With dd you can copy it and repair it later. And you will not have to reinstall bootloader after doing it with dd.
Also rsync allows you copying data over network. You could also use tar + netcat for this.
What is so horribly wrong with all those tools that you consider cp the one and only way to copy one drive to another?
BTW, with rm it's also just one wrong hit. Like space after / in rm /tmp/* |
|
Back to top |
|
|
|