Copying /dev/* to another partition
Randall Tidd
rtidd at mwunix.mitre.org
Thu May 31 01:09:41 AEST 1990
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 at mwunix.mitre.org
#define DISCLAIM TRUE
More information about the Comp.unix.questions
mailing list