Author Topic: Swap 32gb Cf For Microdrive  (Read 14293 times)

rogalian

  • Newbie
  • *
  • Posts: 22
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #15 on: April 07, 2008, 11:31:25 am »
Cat gives same results as dd - won't work unless devices are the same or close enough

Use the tar method!

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3707
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #16 on: April 07, 2008, 11:32:30 am »
given that the cards are different sizes and therefore your partitioning needs to be different, you're going to run into a world of pain copying the card raw block style; just use "fdisk" to partition the target, "mkfs.ext2 /dev/X" to format it, then mount and copy files. really, it's actually not hard :-)
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

ArchiMark

  • Administrator
  • Hero Member
  • *****
  • Posts: 1830
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #17 on: April 07, 2008, 11:36:50 am »
Quote from: speculatrix
you're missing a dot

cd /mnt/hda2
tar cf - . | (cd /mnt/cf1 ; tar xf - )


you cd into the source directory so that when you do the tar the current directory is the "root" of all the files; the "-" in the tar command outputs the stream to stdout; the stream is piped into a separate shell (the brackets) which starts in the destionation directory and unpacks the incoming stream from stdin.

the same trick works over an ssh session.

Just to clarify, in looking at the above, shouldn't the first 'tar' above be for the 'hda2' partition, not 'cf' as shown??

In other words, shouldn't the above look like this?

Code: [Select]
#cd /
#tar / - . | (cd /mnt/cf1; tar xf - )

Thanks!
Silicon Valley Digerati - * Please see my Mini Laptops For Sale Listing *
Cosmo Communicator / One-Netbook One Mix Yoga 3S (Win 10/Manjaro 18)
Banana Pi Zero UMPC/Armbian
MacBookPro
Sold: C3200/N900/OQO/N5/Dell Mini9/Netwalker/UMID M1/

ArchiMark

  • Administrator
  • Hero Member
  • *****
  • Posts: 1830
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #18 on: April 07, 2008, 11:41:03 am »
Quote from: speculatrix
given that the cards are different sizes and therefore your partitioning needs to be different, you're going to run into a world of pain copying the card raw block style; just use "fdisk" to partition the target, "mkfs.ext2 /dev/X" to format it, then mount and copy files. really, it's actually not hard :-)


I did format partition after I created it, speculatrix....so that's already done...

As for copying files, I can do that, just assumed that this might not work as when you try to do that with a Windoze install...it won't make for a bootable drive, you have to use a cloning app in order to get an exact duplicate of drive that boots....

So, if Linux is different than Windoze in this regard, then no problem, I'll just copy the directories over to the CF card....


Hope this makes sense....
« Last Edit: April 07, 2008, 11:59:49 am by ArchiMark »
Silicon Valley Digerati - * Please see my Mini Laptops For Sale Listing *
Cosmo Communicator / One-Netbook One Mix Yoga 3S (Win 10/Manjaro 18)
Banana Pi Zero UMPC/Armbian
MacBookPro
Sold: C3200/N900/OQO/N5/Dell Mini9/Netwalker/UMID M1/

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3707
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #19 on: April 07, 2008, 12:08:55 pm »
"tar cf" is the command, "c" means create, "f" means the next argument is the output file (- means use stdout). "tar xf" means extract with source being stdin.

if you're copying the root partition, you will need to exclude the target mount point, eg.

cd /
tar cf - . --exclude=/mnt/newdir |  ( cd /mnt/newdir ; tar xf - )
« Last Edit: April 07, 2008, 12:09:44 pm by speculatrix »
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3707
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #20 on: April 07, 2008, 12:10:52 pm »
p.s. if you're copying with tar, the target disk/partition needs to be formatted and mounted in advance.

if you're cloning with cat or dd, the partition should NOT be mounted at the time.
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

ArchiMark

  • Administrator
  • Hero Member
  • *****
  • Posts: 1830
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #21 on: April 07, 2008, 12:34:21 pm »
Quote from: speculatrix
"tar cf" is the command, "c" means create, "f" means the next argument is the output file (- means use stdout). "tar xf" means extract with source being stdin.

if you're copying the root partition, you will need to exclude the target mount point, eg.

cd /
tar cf - . --exclude=/mnt/newdir | ( cd /mnt/newdir ; tar xf - )

I get it now, speculatrix!!!....I thought that the 'cf' there was referencing 'cf' as in 'compact flash'......

 


Quote from: speculatrix
p.s. if you're copying with tar, the target disk/partition needs to be formatted and mounted in advance.

if you're cloning with cat or dd, the partition should NOT be mounted at the time.

Thanks for clarifying that....so, I did the clone with 'cat' wrong as I had mounted the partition I think....

Meanwhile, I'm just copying over directories to CF card now....
Silicon Valley Digerati - * Please see my Mini Laptops For Sale Listing *
Cosmo Communicator / One-Netbook One Mix Yoga 3S (Win 10/Manjaro 18)
Banana Pi Zero UMPC/Armbian
MacBookPro
Sold: C3200/N900/OQO/N5/Dell Mini9/Netwalker/UMID M1/

ArchiMark

  • Administrator
  • Hero Member
  • *****
  • Posts: 1830
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #22 on: April 07, 2008, 01:21:53 pm »
Copying over directories...most copying over OK, but have had a few error messages:


Code: [Select]
#cp -r /proc /mnt/cf1
Warning: /proc/ide/hd?/settings interface is obsolete, and will be removed soon!
cp: cannot open `/proc/sys/net/ipv4/route/flush' for reading: Permission denied
cp: cannot open `/proc/sys/net/ipv6/route/flush' for reading: Permission denied
process `cp' is using deprecated sysctl (syscall) net.ipv6.neigh.default.retrans_time:
Use net.ipv6.neigh.retrans_time_ms instead.
cp: reading `/proc/sysrg-trigger': Input/output error

No more HD green light activity showing and command prompt has not returned after 10 minutes...

????

 

Thanks!
Silicon Valley Digerati - * Please see my Mini Laptops For Sale Listing *
Cosmo Communicator / One-Netbook One Mix Yoga 3S (Win 10/Manjaro 18)
Banana Pi Zero UMPC/Armbian
MacBookPro
Sold: C3200/N900/OQO/N5/Dell Mini9/Netwalker/UMID M1/

rogalian

  • Newbie
  • *
  • Posts: 22
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #23 on: April 07, 2008, 03:30:38 pm »
The stuff in /proc you needn't worry about, it's auto generated by the kernel

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3707
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #24 on: April 07, 2008, 03:40:30 pm »
ooops, yes, exclude /proc and /sys too. probably not a bad idea to clean out /tmp too.
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

ArchiMark

  • Administrator
  • Hero Member
  • *****
  • Posts: 1830
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #25 on: April 07, 2008, 10:32:24 pm »
Thanks for the advice, rogalian & speculatrix!

 
Silicon Valley Digerati - * Please see my Mini Laptops For Sale Listing *
Cosmo Communicator / One-Netbook One Mix Yoga 3S (Win 10/Manjaro 18)
Banana Pi Zero UMPC/Armbian
MacBookPro
Sold: C3200/N900/OQO/N5/Dell Mini9/Netwalker/UMID M1/

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3707
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #26 on: April 08, 2008, 04:52:57 pm »
let us know when you're back up and running.
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

ArchiMark

  • Administrator
  • Hero Member
  • *****
  • Posts: 1830
    • View Profile
Swap 32gb Cf For Microdrive
« Reply #27 on: April 08, 2008, 11:18:46 pm »
Quote from: speculatrix
let us know when you're back up and running.

Thanks speculatrix.....

Meanwhile, copied over directories, cleaned out 'tmp'.....

Just did 'df' and here's what I see:
Code: [Select]
Filesystem     1K-blocks      Used     Available    Use%     Mounted on
/dev/hda2     5589680      1317404     3988328     25%    /
tmpfs               31180                 0        31180       0%    /lib/init/rw
udev                10240               80        10160       1%    /dev
tmpfs               31180                 4        31176       1%    /dev/shm
/dev/hdc1     5589680      2419708     2886024     46%    /mnt/cf1

So......why does my existing microdrive with Debian EABI only use 25% of the drive and the new 32GB CF card use 46% of drive???

Maybe I'm just being overly cautious with all of this...but I'm trying to avoid situation where I yank out microdrive, take apart my Z and install CF card, put Z back together, and voila! it doesn't boot up or something like that....

Thanks!
Silicon Valley Digerati - * Please see my Mini Laptops For Sale Listing *
Cosmo Communicator / One-Netbook One Mix Yoga 3S (Win 10/Manjaro 18)
Banana Pi Zero UMPC/Armbian
MacBookPro
Sold: C3200/N900/OQO/N5/Dell Mini9/Netwalker/UMID M1/

ajnk

  • Newbie
  • *
  • Posts: 39
    • View Profile
    • http://
Swap 32gb Cf For Microdrive
« Reply #28 on: April 09, 2008, 05:08:57 am »
I had to do something similar last night, when I managed to make my 16gb CF unbootable, fortunately i had my 4gb I was using until about 1 month ago :-

1) Attached 4gb microdrive to laptop using USB adapter, checked the filesystem (just to be safe).
2) Mount 4gb microdrive (/media/disk in this case)
3) cd /media/disk
4) copy contents to laptop HD (I wanted a) a backup  a fast way to redo the process if I messed up)
     mkdir /home/andy/z/cf_recovery
     find . | cpio -pdmv /home/andy/z/cf_recovery
5) wait .......
6) once the copy was complete umount /media/disk
7) Disassemble Z (c3100 in my case)
9) Retrieve CF card from Z, attach to lappy via USB.
10) It automounted on /media/disk, so I unmounted it.
11) Create an ext2 filesystem (yes I want ext3 journaling, but i am going to dump a lot of data in a stable environment so I don't need the journal - it would only slow things down).
     mke2fs /dev/hdb1
     tune2fs -i 0 -c 0  /dev/hda1
     (turns off fsck after a number of mounts).
12) mount the cf card (mount /dev/hdb1 /media/disk)
13) cd /home/andy/z/cf_recovery
13) find . | cpio -pdmv /media/disk
14) wait .....
15) umount cf card, insert in Z, rebuild Z - hey presto - working fs

BTW. If you need to repeat step 13) for any reason either remake the filesystem or add the 'u' flag (unconditional overwrite) to the cpio.

Hope this helps
ajnk

(Then I did an apt-get update ; apt-get upgrade )

ZDevil

  • Hero Member
  • *****
  • Posts: 1998
    • View Profile
    • http://
Swap 32gb Cf For Microdrive
« Reply #29 on: April 09, 2008, 08:19:48 am »
Good to know that things are working now.
ajnk: so do you mean the latest yonggun kernel can boot off an ext2 partition? I remember the previous one only takes ext3 ...
« Last Edit: April 09, 2008, 08:20:06 am by ZDevil »

Life is too precious for hacking *too much*
Visit my Z screencap gallery[/color]
My EeePC 701 Black = Debian (Lenny) on IceRocks + Transcend SDHC Class6 8GB + 2GB RAM
My Zaurus SL-C3200 = Debian EABI (kernel 2.6.24.3-yonggun) on a swapped internal Sandisk Extreme III CF 16gb
My Debian EABI feed: http://matrixmen.free.fr/zaurus/debian/
My OpenBSD/Zaurus feeds:  Link1, Link2
[/i][/font][/color][/size]