Solved

cpio: Operation not permitted

Posted on 2003-11-20
22
1,088 Views
Last Modified: 2013-12-16
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?
0
Comment
Question by:Gnustome
  • 11
  • 8
  • 3
22 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 9794850
/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
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9800775
find  boot -print0 | cpio -p0vumd /mnt/Linux.Backup

0
 

Author Comment

by:Gnustome
ID: 9801394
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.
0
 

Author Comment

by:Gnustome
ID: 9801403
I've increased the point value to 500, since this has become more complex than it initally appeared.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 9802746
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.

0
 

Author Comment

by:Gnustome
ID: 9803803
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
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9805043
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
0
 

Author Comment

by:Gnustome
ID: 9805084
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.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9805124
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
0
 

Author Comment

by:Gnustome
ID: 9805152
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 /
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9805189
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".

0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 38

Expert Comment

by:yuzh
ID: 9805711
"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"


0
 

Author Comment

by:Gnustome
ID: 9806733
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.
0
 

Author Comment

by:Gnustome
ID: 9807805
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?
0
 

Author Comment

by:Gnustome
ID: 9808466
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.
0
 

Author Comment

by:Gnustome
ID: 9813753
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.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9814608
restore from partimage must be as easy as creating.

have to read this doc.
http://www.partimage.org/doc/index-3.html
0
 
LVL 24

Accepted Solution

by:
shivsa earned 500 total points
ID: 9814626
Saving An Image:
-----------------------

The following describes how  create an image of  root partition:

1) You can download partimage from the link above, then create the root/boot floppy disks or download the bootcd.iso and create a bootable Partition Image CD with a cdburner. For more info:
Partition Image Documentation

2) Next, boot Partimage with either the root/boot disks or the bootable cdrom.

3) You must mount a partition to save the image file to, this can not be the same partition that you are backing up. For this document I'm going to backup my root partition (/dev/hda6) to another partiton that I created to store backups and other files on (/dev/hda7). Both of these partitions are reiserfs filesystems so I mounted the backup partition with:

mount  -t  reiserfs  /dev/hda7  /mnt

4) Next type: partimage

5) Tab to: "image file to create/use", then type in the directory to save to and the name of what you want the image to be called. For example:

/mnt/rootimage.tgz

6) Next, tab to: "action to be done", choose "save partition into a new image file", hit F5 to continue. Note: Use the space bar to select/deselect an item.

7) Now choose your compression level, I chose "Gzip", go over the rest of the options and hit F5 to finish. You can create a smaller image file with Bzip2 but this will take longer, if you use this option make sure you change the extension in step 5 to to /mnt/rootimage.bz2

The root partition that I backed up was 1.5 GB, the resulting image file was 563 Mb and the whole process took about 12 minutes to complete.

Restoring An Image:
==================

All data already on the partition you are restoring to will be lost!

1) Boot partimage and at the command prompt, mount the partition where the image to be restored was saved to, for example:

mount  -t  reiserfs  /dev/hda7  /mnt

2) Next, type partimage then tab to the existing partition where you want the image to be copied to.

3) Enter the path to the image file under "Image file to create/use" for example:

/mnt/rootimage.tgz

4) Choose "Restore partition from an image file", hit F5 to continue to the next screen. Here you can optionally select "Erase free blocks with zero values", hit F5 again to finish.

==========================
--------------------------------------------------------------------------------
Restoring Boot Loader
-----------------------------
If you dual boot, you most likely have a boot manager installed and you will have to restore Grub or Lilo to the MBR.  After restoring the image you'll need to boot with the rescue disk mentioned earlier, then as root open a console and type the following:

Grub:
grub-install /dev/hda

hda = for primary master MBR
hdb = for secondary slave MBR

Lilo:
/sbin/lilo
0
 

Author Comment

by:Gnustome
ID: 9814972
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?
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9815018
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.
0
 

Author Comment

by:Gnustome
ID: 9815091
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?
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9815266
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.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now