Solaris tar command to ignore mount points?


 
Thread Tools Search this Thread
Operating Systems Solaris Solaris tar command to ignore mount points?
# 1  
Old 05-05-2017
Solaris tar command to ignore mount points?

i.e. to stay in local filesytem.

I believe the flag in linux is one-file-system. Is there corresponding in solaris?

SOLARIS 9 BTW.

Last edited by psychocandy; 05-05-2017 at 12:56 PM..
# 2  
Old 05-05-2017
Depending on your release, there are couple of options.

1. You can use find -xdev option and feed it to tar utility via pipe and xargs.
This should be quite portable solution, the internet is full of examples.

2. On newer releases (11 and on), gnu tar is (probably) installed and can be invoked as gtar.
Also, other gnu utilities can be invoked with g prefix (gfind gsed ..)

Please, if you ask questions on this forum, you will get much more precise answers by specifying your operating system version and shell you are using.

Hope that helps
Regards
Peasant.
This User Gave Thanks to Peasant For This Post:
# 3  
Old 05-05-2017
As Peasant says, what O/S version exactly?

Talking generic Solaris, you can:

Code:
# find /path/to/files | xargs tar cvf archive.tar

or (depending on whether you want to write a relative path to the archive)

Code:
 # cd /path/to/files
 # find . | xargs tar cvf archive.tar

to pipe 'find' into 'tar'

THEN, to answer your question, restrict the find to the current filesystem only by using the -mount switch on 'find', for example:

Code:
# find -mount /path/to/files | xargs tar cvf archive.tar

You may also need to use other switches on 'find' to refine the file selection eg, date/time filters, file type, etc.

Hope that helps, perhaps is doesn't. Which O/S is it????
This User Gave Thanks to hicksd8 For This Post:
# 4  
Old 05-05-2017
Thanks its solaris 9.

So if I had two mount points /export and /export/home and I only wanted to tar the stuff in export (And subdirectories) but NOT /export/home then find -mount would work?

Moderator's Comments:
Mod Comment Please don't use quotes for the post just before your new post!

Last edited by DukeNuke2; 05-05-2017 at 09:05 PM..
# 5  
Old 05-05-2017
I think that, assuming you have a root filesystem (/), a /export, and a /export/home all as individual filesystems, then I reckon so.

Basically, look at it like this. The -mount switch restricts 'find' to the filesystem of the directory that you are currently in. Therefore, you would need to:

Code:
# cd /export
# find -mount . | xargs tar cvf archive.tar

Give that a go on Solaris 9. Tell me if I'm wrong.

---------- Post updated at 05:10 PM ---------- Previous update was at 05:02 PM ----------

Of course, unless the /export filesystem contains other mount points to lower levels, what I wrote above would just work anyway without the '-mount'. It just creates a relative path backup which can therefore be restored to anywhere on the system you choose (which is good practice).

---------- Post updated at 05:25 PM ---------- Previous update was at 05:10 PM ----------

You could also simply use:

Code:
 # cd /export
 # tar cvf archive.tar .

if /export has no lower mount points on it.
# 6  
Old 05-05-2017
Just for the sake of argument, -xdev option is in the standards, while -mount is not.

If you take a look at the find manuals from solaris, hpux, aix, linux etc. you will find that -xdev is the common denominator for not traversing filesystems in unix or unix like operating system.

Regards
Peasant.
This User Gave Thanks to Peasant For This Post:
# 7  
Old 05-05-2017
That's true but do you remember whether Solaris 5.9 supports 'find -xdev'?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Types of mount points

Hi, What are the types of mount points available in Linux machine and how to find what type of mount point is configured in my linux machine? Is mount point otherwise called as file system or do they have different meaning ? Regards, Maddy (4 Replies)
Discussion started by: Maddy123
4 Replies

2. Red Hat

Mount Points? How?

Hi folks, I have been asked to performed the following: Add the following new moint points systemA:/avp and SystemB:/usr/sap/trans to be the new linux server ZZZ How can I add those mount points and how those mount points can become another linuz server?:wall::wall::wall: (2 Replies)
Discussion started by: 300zxmuro
2 Replies

3. UNIX for Advanced & Expert Users

mount points

hi, I believe a mount point does not have to be a physical disk, but rather a logical one? Is this correct? if so, how can I find out if my mount points are on different physical disks? thanks (9 Replies)
Discussion started by: JamesByars
9 Replies

4. HP-UX

Cannot unmount mount points??

When taking a snap, I have a script that stops any active snap. When running the script, I'm getting a message that u02 and u04 are already mounted. How can I find out what process(es) is/are latching on the these mount points? Thank you for your time. (1 Reply)
Discussion started by: genzbeat
1 Replies

5. UNIX for Dummies Questions & Answers

NFS Mount Points

Hi Solaris 10 On server A, there is a directory called data with 10 files. This data directory has a further 3 subdirectories, gl, pay, contract (for example) On server B, I want to see the server A data directory commands used: on server A, share -F nfs -o ro -d "<description">... (1 Reply)
Discussion started by: davidra
1 Replies

6. UNIX for Dummies Questions & Answers

Mount Points at reboot

How do I make a mount point reconnect at boot without editing /etc/fstab? Is there an option (or switch) to make this persistent when issuing the mount command from a client? (1 Reply)
Discussion started by: AIXdumb455
1 Replies

7. UNIX for Dummies Questions & Answers

tar using mount points

hi i tried to tar a directory in my server but it show ensufficient space. therefore i tried to save it to a mount point using tar /mountpoint/newfilename file2btar but it gives me permission denied. i am using the root account to do this. is it possible to tar files and put it to mounted... (3 Replies)
Discussion started by: legato
3 Replies

8. UNIX for Dummies Questions & Answers

pwd Command and NIS mount points

I am running NIS, NFS and automount. If I execute % cd /xyz/data1 % pwd I get different results depending on the operating system. On SGI running Irix 6.5.x pwd returns /xyz/data1 On Redhat Linux 7.3 pwd returns /xyz/data1 BUT On Tru64 UNIX the pwd command returns... (1 Reply)
Discussion started by: agreenwo
1 Replies

9. UNIX for Advanced & Expert Users

mount points

sometimes in Solaris 8 when I go to mount filesystems using either the mount command or by editing the /etc/vfstab, i get a nice little error message saying the the number of allowable mount points has been exceeded. I have read man pages until I am blue in the face and no where can I find what the... (3 Replies)
Discussion started by: manderson19
3 Replies

10. UNIX for Dummies Questions & Answers

how to mount a hotswap scsi drive on a solaris 2.6 netra box using the mount command?

Hi... question is this: How do I mount an LVD hotswap scsi drive in bay #2 on a netra using the mount command? volmgt doesn't seem to mount it and/or I don't know how to view the drives data if it's formatted which it may not be. This drive is not new out of the box so I'm not sure. ... (4 Replies)
Discussion started by: soulshaker
4 Replies
Login or Register to Ask a Question