Link to home
Start Free TrialLog in
Avatar of Gnustome
Gnustome

asked on

cpio: Operation not permitted

I executed
find boot -print | cpio -oacv | (cd /mnt/Linux.Backup ; cpio -icdmuv).  

Eleven of the 12 files in boot were copied to /mnt/Linux.Backup.  But when it came to boot.b the following error message appeared.

cpio: boot/boot.b: Operation not permitted

What went wrong?
Avatar of yuzh
yuzh

/boot/boot.b
    This is installed as the basic boot sector. In the case of most modern
    distributions it is actually a symobolic link to one of four files /boot/
    boot-bmp.b, /boot/boot-menu.b, /boot/boot-text.b, /boot/boot-compat.b
    which allow a user to change the boot-up schema so that it utilises a
    splash screen, a simple menu, a text based interface or a minimal boot
    loader to ensure compatibility respectively. In each case re-installation
    of lilo is necessary in order to complete the changes. To change the
    actual 'boot-logo' you can either use utilites such as fblogo or the more
    refined bootsplash.
   
    more details:
    http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/Linux-Filesystem-Hierarchy.txt

    Not sure why cpio cann't handle it. (I have used cpio for different *nix machines, never
have any problem).

    Try to do:
    cp -p /boot/boot.b /mnt/Linux.Backup/boot/boot.b

    or
    cp -p /boot/boot.b /mnt/Linux.Backup/boot.b

    see what happen
find  boot -print0 | cpio -p0vumd /mnt/Linux.Backup

Avatar of Gnustome

ASKER

When I executed
find boot -print0 | cpio -p0vumd /mnt/Linux.Backup
when it got to boot.b the result was the same as before:
cpio: /mnt/Linux.Backup/boot/boot.b: Operation not permitted

When I executed
cp -pv /boot/boot.b /mnt/Linux.Backup/boot/boot.b
the file was copied.  But is that a solution?  I thought cp was the wrong command to use for backup and restore purposes?  I thought cpio and dump were the commands that were needed.  I chose cpio because man dump states that it is for ext2 filesystems.  I have ext3.  If I understand correctly ext3 is an extension of ext2, so maybe the differences would be irrelevant.  But I would need clarification of that.
I've increased the point value to 500, since this has become more complex than it initally appeared.
In most case, cpio should do the job, it can handle special files. (as I already
mentioned, I have used it for other *nix favour backup, it never fail).

the "cp" command it not for system level backup. (it might not be able to handle
some of the special files). In your case, it is a workaround when cpio failed.

Have you try to use dump/restore? it is also a good tool.

I executed:
dump 0uf -boot | (cd /mnt/Linux.Backup ; restore rf -)
The response was:
     DUMP: Must specify disk or filesystem
     DUMP: The ENTIRE dump is aborted.
restore: Tape read error on first record
for dump, i would say
try using like
dump Ouf /boot(or diskname /dev/hd2)

could u try this one.
find /boot -mount -print | cpio -ocB /mnt/Linux.Backup
When I tried the cpio command, it printed out the word Usage: followed by many lines of options to be used with cpio.

When I executed:
dump 0uf /boot (/dev/hde5/Linux.Backup)
the response was:
bash: syntax error near unexpected token '(/'

When I executed:
dump 0uf /boot /dev/hde5/Linux.Backup
the response was:
   DUMP: You can't update the dumpdates file when dumping a subdirectory
   DUMP: The ENTIRE dump is aborted.
nope
I suppose boot is mounted like
/boot on /dev/hde5.
then
dump 0uf /dev/hde5 /mnt/Linux.Backup
dump 0uf /boot  /mnt/Linux.Backup
No, I guess I misunderstood your post.  The entry in /etc/fstab is:
/dev/hde5     /mnt     vfat     defaults,umask=0000     0     0
and Linux.Backup is a directory on /dev/hde5.

/boot is mounted on /
i see the problem now.
your boot is mounted on /. mostly it is different from the root partition.

backup are taken when  /boot is unmounted. and nothing is getting changed during backup.

in your case u can umount /boot because here / and /boot are the same.

i would suggest goin to level 1, and try again.

The /boot is only really used during booting so doesn't need to be mounted for everyday use. it is also needed when  running lilo or compiling kernels.
also u can use partimage to take backups and restore, it is really a good product.
http://www.partimage.org/

also u can use dd for backups too.
like if u want to backup the boot sector.
dd if=/dev/hd?? of=/mnt/other_drive/bootsect.img bs=512 count=1".

"I executed:
dump 0uf -boot | (cd /mnt/Linux.Backup ; restore rf -)"

it should be:

dump 0uf - boot | (cd /mnt/Linux.Backup ; restore rf -)

PS: "-" is stdout (you screen) you need to type a WHITE
      space between "-" and "boot"


I still get a response of:
bash: syntax error near unexpected token '(c'

I'm going to look at partimage.  That may be what I was looking for.
Shivsa, I downloaded and installed partimage via apt-get install partimage.  I edited fstab to include /dev/hde7 instead of /dev/hde5, because I needed more room.Without rebooting, /mnt was empty, so I created directory Linux.Backup, which made it the only directory on /mnt.  I backed up the Linux partition (/dev/hde3) to /mnt/Linux.Backup.  The backup image was assigned filename /mnt/Linux.Backup/parimage.img.000.  I then booted into Windows, but Linux.Backup was not present on /dev/hde7 (F: drive).  I created directory Linux.Backup, then rebooted into Linux.  At that time /mnt was populated with all the directories on F: drive.  I backed up the Linux partition again to /mnt/Linux.Backup, and the backup image was assigned file name /mnt/Linux.Backup/parimage.img.000.000.  I booted into Windows, and found the image file I had just created.  I booted back into Linux, and deleted the file using rm -vR Linux.Backup.  That got rid of the second image and it's directory.  But it appears the first image is still occupying space on /dev/hde7, but is hidden.  How do I find it and delete it, if necessary, so it isn't taking up space?
Shivsa, I have another problem.  My most recent backup was labeled /mnt/Linux.Backup/parimage.img.001.000.  There was no problem with creating the image, but I couldn't use the image to restore the partition, as a test of my ability to do so.  In the first window, when I tabbed down to the part that gave the option of create, restore, restore an MBR, I was unable to uncheck create, and check restore.  How do I do that?

Also, I could go to /mnt/Linux.Backup and run dir and find the image file.  But using slocate or KDE Find Files turned up nothing when searching / or even /mnt/Linux.Backup.
Shivsa, I've solved the mystery of the missing file parimage.img.000.  I removed from fstab all entries that refered to partitions shared with Windows, i.e., hde5 and hde7.  I then rebooted.  When I ran dir from /mnt the only directory was Linux.Backup, and the only file in that directory was the .000 file.  I deleted the directory and file.

Now, my only problem is being able to restore from an .img file, as I indicated above.  I have a boot floppy and a root floppy, since my method of installation was bf2.4, but the root floppy doesn't have partimage on it.  If I could find out how to restore from the HD, I could always boot into Linux using the floppies, then apt-get install partimage, then restore from the .img file.

Compiling a kernel is something I intend to learn to do some day, but it appears to be needed in order to create a boot floppy the partimage way (/usr/share/doc/partimage/BOOT-ROOT-creation.txt).  I have to be able to restore somehow, though, or having a backup is useless.
restore from partimage must be as easy as creating.

have to read this doc.
http://www.partimage.org/doc/index-3.html
ASKER CERTIFIED SOLUTION
Avatar of shivsa
shivsa
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I figured out how to use the space bar, but thanks anyway.

It looks, from the partimage.org download page, that if I download the bootable .iso image and burn it to a CD I could do that on any computer and it would still function to boot me into Linux on my Linux computer.  Is that correct?

When I was installing Linux I installed the OS on a primary physical partition.  I also created a swap partition.  But when I tried to create additional logical partitions I was not allowed to do so.  Therefore, the OS and all files are on hde3.  But I created a backup image on hde7: specifically /mnt/F/Linux.Backup/parimage.img.001.000.  Tell me if I am wrong, but it seems to me that if I ever needed to restore that image (which will probably change weekly) I could boot from the boot floppy I already have, change to the root floppy to boot all the way into a minimal install of Linux, execute apt-get install partimage, mount hde7, run partimage, and restore parimage.img.001.000.  Since partimage will be running from RAM, it won't matter that the newly installed files get overwritten.  I could then run partimage again and invoke the third option, to use the image to restore the MBR (on which Lilo is stored).  Will that fly?
sound good to me.
but still i would suggest u to get your backup somewhere on CDROM. yes u can do from any computer but burn in iso format, readable to linux.

also i would suggest try it out once the whole procedure and see where u may see the problem.
My CD burner is on another computer on the LAN, which uses NTFS.  hde7 is FAT 32.  So I would have to transfer the image file from FAT 32 to NTFS, then burn it in .iso format.  Unless I use the network feature of partimage and burn the image directly from Linux to the CD.  Is that possible?
i will say use network feature of partimage.
i am afraid compatibility between FAT32 vs NTFS. it does not matter once we write the iso image but even i do not trust MS.