removing a file

I initialized a hard drive using the dinit utility.

dinit -h /dev/hd0t77

After the initialization, I wanted to remove the
…boot and .altboot files. I used “rm” to do just that

But it gave the following message:
Can’t unlink .boot: Resource Busy.

Is there a way to delete these files?

Thank you,
Shashank

Shashank <sbalijepalli@precitech.com> wrote:

I initialized a hard drive using the dinit utility.

dinit -h /dev/hd0t77

After the initialization, I wanted to remove the
.boot and .altboot files. I used “rm” to do just that

But it gave the following message:
Can’t unlink .boot: Resource Busy.

Is there a way to delete these files?

No.

They are always there, they must always be there, they can not
go away.

They can, of course, be zero-length, and are by default.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

I compressed my entire root directory using the “tar” utility. I would like
to uncompress the tar file onto my hard drive. But when I untar, it doesn’t
copy the .boot and .altboot files and they stay 0 length even though my tar
file contains >0 length .boot and .altboot files. Is there any option that I
could use with tar so that it would forcefully write the .boot and .altboot
files that are created with dinit?

Thank you,
Shashank




“David Gibbs” <dagibbs@qnx.com> wrote in message
news:b891fd$44s$2@nntp.qnx.com

Shashank <> sbalijepalli@precitech.com> > wrote:
I initialized a hard drive using the dinit utility.

dinit -h /dev/hd0t77

After the initialization, I wanted to remove the
.boot and .altboot files. I used “rm” to do just that

But it gave the following message:
Can’t unlink .boot: Resource Busy.

Is there a way to delete these files?

No.

They are always there, they must always be there, they can not
go away.

They can, of course, be zero-length, and are by default.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Shashank <sbalijepalli@precitech.com> wrote:
S > I compressed my entire root directory using the “tar” utility. I would like
S > to uncompress the tar file onto my hard drive. But when I untar, it doesn’t
S > copy the .boot and .altboot files and they stay 0 length even though my tar
S > file contains >0 length .boot and .altboot files. Is there any option that I
S > could use with tar so that it would forcefully write the .boot and .altboot
S > files that are created with dinit?

S > Thank you,
S > Shashank


Several utilities treat /.boot & /.altboot special. If you tried to:
cp /* //x/
cp will skip .boot & .altboot. BUT I know that you can:
cp /.boot //x/
that will force .boot or .altboot to copy. Try to specifically extract
just that file from your tar archive.

I haven’t actually tried this with tar, but good luck.

Bill Caroselli <qtps@earthlink.net> wrote:

Shashank <> sbalijepalli@precitech.com> > wrote:
S > I compressed my entire root directory using the “tar” utility. I would like
S > to uncompress the tar file onto my hard drive. But when I untar, it doesn’t
S > copy the .boot and .altboot files and they stay 0 length even though my tar
S > file contains >0 length .boot and .altboot files. Is there any option that I
S > could use with tar so that it would forcefully write the .boot and .altboot
S > files that are created with dinit?

S > Thank you,
S > Shashank



Several utilities treat /.boot & /.altboot special. If you tried to:
cp /* //x/

That’s not the utility cp doing anything special. That is because the
shell expansion * does not match .* – try doing “echo /" then try
doing "echo /.
”.

that will force .boot or .altboot to copy. Try to specifically extract
just that file from your tar archive.

Back to tar – does it give any errors during the extraction?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

If I remember correctly, it says “resource busy” while trying to extract the
…boot and .altboot files and they
are not overwritten. I haven’t tried specifically extracting these 2 files,
so I am not sure if that works.

Shashank

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:b89fbs$cqf$2@nntp.qnx.com

Bill Caroselli <> qtps@earthlink.net> > wrote:
Shashank <> sbalijepalli@precitech.com> > wrote:
S > I compressed my entire root directory using the “tar” utility. I
would like
S > to uncompress the tar file onto my hard drive. But when I untar, it
doesn’t
S > copy the .boot and .altboot files and they stay 0 length even though
my tar
S > file contains >0 length .boot and .altboot files. Is there any
option that I
S > could use with tar so that it would forcefully write the .boot and
…altboot
S > files that are created with dinit?

S > Thank you,
S > Shashank


Several utilities treat /.boot & /.altboot special. If you tried to:
cp /* //x/

That’s not the utility cp doing anything special. That is because the
shell expansion * does not match .* – try doing “echo /" then try
doing "echo /.
”.

that will force .boot or .altboot to copy. Try to specifically extract
just that file from your tar archive.

Back to tar – does it give any errors during the extraction?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Shashank <sbalijepalli@precitech.com> wrote:

If I remember correctly, it says “resource busy” while trying to extract the
.boot and .altboot files and they
are not overwritten. I haven’t tried specifically extracting these 2 files,
so I am not sure if that works.

I THINK that tar operates by unlinking each item, then doing an
open( O_CREAT) for the new files, but only doing the open if
it succeed on the unlink. It would fail on the unlink for
/.boot and /.altboot (they can never be unlinked/removed),
so would never try to write the new image to them.

You may have to special case the handling of /.boot and /.altboot.
(e.g. have you backup script cp them both to /tmp, back them up
from there, then have your restore script de-archive, then cp from
/tmp back again.)

-David

Shashank

“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:b89fbs$cqf$> 2@nntp.qnx.com> …
Bill Caroselli <> qtps@earthlink.net> > wrote:
Shashank <> sbalijepalli@precitech.com> > wrote:
S > I compressed my entire root directory using the “tar” utility. I
would like
S > to uncompress the tar file onto my hard drive. But when I untar, it
doesn’t
S > copy the .boot and .altboot files and they stay 0 length even though
my tar
S > file contains >0 length .boot and .altboot files. Is there any
option that I
S > could use with tar so that it would forcefully write the .boot and
.altboot
S > files that are created with dinit?

S > Thank you,
S > Shashank


Several utilities treat /.boot & /.altboot special. If you tried to:
cp /* //x/

That’s not the utility cp doing anything special. That is because the
shell expansion * does not match .* – try doing “echo /" then try
doing "echo /.
”.

that will force .boot or .altboot to copy. Try to specifically extract
just that file from your tar archive.

Back to tar – does it give any errors during the extraction?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.


QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

It’s not possible to restore .boot and .altboot file from archive into root
directory.

Solution:

gzip -cd $1 |
pax -ro
-s “,^backup/.boot,$2/$TMP_DIR/.boot,”
-s “,^backup/.altboot,$2/$TMP_DIR/.altboot,”
-s “,^backup,$2,”

cp $2/$TMP_DIR/.boot $2/.boot
cp $2/$TMP_DIR/.altboot $2/.altboot
rm -rf $2/$TMP_DIR

$1 - archive file
$2 - target dir
$TMP_DIR - temporary dir ( could be $$ )
“^backup” - added prefix for files in archive



“Shashank” <sbalijepalli@precitech.com> wrote in message
news:b891e0$90p$1@inn.qnx.com

I compressed my entire root directory using the “tar” utility. I would
like
to uncompress the tar file onto my hard drive. But when I untar, it
doesn’t
copy the .boot and .altboot files and they stay 0 length even though my
tar
file contains >0 length .boot and .altboot files. Is there any option that
I
could use with tar so that it would forcefully write the .boot and
…altboot
files that are created with dinit?

Thank you,
Shashank




“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:b891fd$44s$> 2@nntp.qnx.com> …
Shashank <> sbalijepalli@precitech.com> > wrote:
I initialized a hard drive using the dinit utility.

dinit -h /dev/hd0t77

After the initialization, I wanted to remove the
.boot and .altboot files. I used “rm” to do just that

But it gave the following message:
Can’t unlink .boot: Resource Busy.

Is there a way to delete these files?

No.

They are always there, they must always be there, they can not
go away.

They can, of course, be zero-length, and are by default.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.