rtidd@mwunix.mitre.org (Randall Tidd) (05/30/90)
I am running SunOS 4.1 on a Sun 3/160. I am trying to clone my root partition to a backup partition (just root and subdirectories, but *not* other partitions such as /usr, /home, etc). I ran into a problem when trying to copy /dev; when I try to cp /dev/sd0a (for example), it will try to read from the device /dev/sd0a rather than copy the actual file /dev/sd0a. I started to write a script to do it, but it was hard to parse out the permissions; I started to write a C program to do it, but ran into other problems: # ls -l /dev/fd* brw-rw-rw 2 root 16, 2 May 29 15:23 /dev/fd0 brw-rw-rw 1 root 16, 0 May 29 15:23 /dev/fd0a brw-rw-rw 1 root 16, 1 May 29 15:23 /dev/fd0b brw-rw-rw 2 root 16, 2 May 29 15:23 /dev/fd0c /dev/fd0 and /dev/fd0c point to the same device (major=16 minor=2), but one is actually a symbolic link to the other (note "number of links" field, second field from left). I would have to handle these cases as well. Rather than writing a lengthly and probably very ugly C program to do this, is there an easier way? I would like to keep the permisionns and number of links intact for each file. I tried doing a dd if=/dev/sd0a of=/dev/sd1a, but the file system got really confused; it didn't think there was anything on /dev/sd1a, and when I erased a couple files it said I was down to -17% capacity! Any help would be appreciated. Thanks in advance! Randy Tidd rtidd@mwunix.mitre.org #define DISCLAIM TRUE
k2@charly.bl.physik.tu-muenchen.de (Klaus Steinberger) (05/31/90)
rtidd@mwunix.mitre.org (Randall Tidd) writes: >I am running SunOS 4.1 on a Sun 3/160. >I am trying to clone my root partition to a backup partition (just >root and subdirectories, but *not* other partitions such as /usr, >/home, etc). I ran into a problem when trying to copy /dev; when I >try to cp /dev/sd0a (for example), it will try to read from the device >/dev/sd0a rather than copy the actual file /dev/sd0a. Use cpio or tar for this purpose. That's the way to do it. Sincerely, Klaus Steinberger Klaus Steinberger Beschleunigerlabor der TU und LMU Muenchen Phone: (+49 89)3209 4287 Hochschulgelaende, D-8046 Garching, West Germany BITNET: K2@DGABLG5P Internet: k2@charly.bl.physik.tu-muenchen.de
jhl@frith.uucp (John Lawitzke) (05/31/90)
From article <109757@linus.UUCP>, by rtidd@mwunix.mitre.org (Randall Tidd): $ I am running SunOS 4.1 on a Sun 3/160. $ $ I am trying to clone my root partition to a backup partition (just $ root and subdirectories, but *not* other partitions such as /usr, $ /home, etc). I ran into a problem when trying to copy /dev; when I $ try to cp /dev/sd0a (for example), it will try to read from the device $ /dev/sd0a rather than copy the actual file /dev/sd0a. Sounds like a job for cpio. Check out its man page. -- j |%|John Lawitzke, Dale Computer Corp., R&D |%|UUCP: uunet!mailrus!sharkey!dale1!jhl |%| or: uunet!frith!dale1!jhl Inquiring minds just wondering. |%|Internet: jhl@frith.egr.msu.edu
lm@snafu.Sun.COM (Larry McVoy) (05/31/90)
In article <2538@tuminfo1.lan.informatik.tu-muenchen.dbp.de> k2@charly.bl.physik.tu-muenchen.de (Klaus Steinberger) writes: >rtidd@mwunix.mitre.org (Randall Tidd) writes: > >>I am running SunOS 4.1 on a Sun 3/160. > >>I am trying to clone my root partition to a backup partition (just >>root and subdirectories, but *not* other partitions such as /usr, >>/home, etc). I ran into a problem when trying to copy /dev; when I >>try to cp /dev/sd0a (for example), it will try to read from the device >>/dev/sd0a rather than copy the actual file /dev/sd0a. > >Use cpio or tar for this purpose. That's the way to do it. And don't forget to install the boot block - just copying it doesn't work. Check out installboot(8). Also - your backup /etc/fstab is going to be different. As a side note to sys admins: what this person is trying to do is *really* handy if you are the sort that trashes partitions. I do file system development and I can't survive w/o a backup root & usr. --- Larry McVoy, Sun Microsystems (415) 336-7627 ...!sun!lm or lm@sun.com
jhl@frith.uucp (John Lawitzke) (05/31/90)
From article <2538@tuminfo1.lan.informatik.tu-muenchen.dbp.de>, by k2@charly.bl.physik.tu-muenchen.de (Klaus Steinberger): $ rtidd@mwunix.mitre.org (Randall Tidd) writes: $>I am trying to clone my root partition to a backup partition (just $>root and subdirectories, but *not* other partitions such as /usr, $>/home, etc). I ran into a problem when trying to copy /dev; when I $>try to cp /dev/sd0a (for example), it will try to read from the device $>/dev/sd0a rather than copy the actual file /dev/sd0a. $ $ Use cpio or tar for this purpose. That's the way to do it. Under SCO Xenix and SCO UNIX, tar does not copy empty directories or device nodes. -- j |%|John Lawitzke, Dale Computer Corp., R&D |%|UUCP: uunet!mailrus!sharkey!dale1!jhl |%| or: uunet!frith!dale1!jhl Inquiring minds just wondering. |%|Internet: jhl@frith.egr.msu.edu
guy@auspex.auspex.com (Guy Harris) (06/01/90)
>Use cpio or tar for this purpose. That's the way to do it.
Well, "cpio", anyway; SunOS "tar" doesn't know about character or block
special files, which are what he's trying to copy. However, "pax"
should, and SunOS 4.1 has "pax".
karish@mindcrf.UUCP (06/01/90)
In article <3412@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: >>Use cpio or tar for this purpose. That's the way to do it. > >Well, "cpio", anyway; SunOS "tar" doesn't know about character or block >special files, which are what he's trying to copy. I've used "dump" and "restore" for this purpose. It's a reliable way to get a quite exact clone of the existing root partition. Pipe "dump | restore", or use a tape to make a backup at the same time. -- Chuck Karish karish@mindcraft.com Mindcraft, Inc. (415) 323-9000