1753424 Members
5236 Online
108793 Solutions
New Discussion юеВ

Re: Tar & lvm

 
Charles Ooi Chia Lun
Occasional Advisor

Tar & lvm

Hi friends,
Good Morning,
i.) Can I know how we use Tar command let say we want to test the tape drive after installation or any other method?

Ii.) When we do a bdf and found that the space is not enough or the percentage is higher, we want to get more space , what should we do?

Please advise your idea & steps , thank you very much.

Regards

3 REPLIES 3
Chandan Kumar_1
Honored Contributor

Re: Tar & lvm

Hi,

The tar method is the traditional UNIX backup and restore method. Its major benefit is that it can be used across many manufacturers' UNIX computers. The same command is used both for backup and restore purposes. The backup created using tar makes efficient use of the media.

Creating a Backup with tar
To create a backup of the /etc and /home directories using the tar command on a tape device, the command is as follows. The tar command uses /dev/rmt/0m as the default tape drive, so you can omit this on the command line.

# tar -cvf /dev/rmt/0m /etc /home
a /etc/MANPATH 1 blocks
a /etc/PATH 1 blocks
a /etc/SHLIB_PATH 1 blocks
a /etc/SnmpAgent.d/snmpinfo.dat 111 blocks
a /etc/SnmpAgent.d/snmpd.conf 14 blocks
a /etc/TIMEZONE 1 blocks
a /etc/X11/X0screens 35 blocks
a /etc/X11/X0devices 16 blocks
a /etc/X11/X0pointerkeys 25 blocks
a /etc/X11/rgb.txt 43 blocks
a /etc/X11/XHPKeymaps 553 blocks
a /etc/X11/fs/config 3 blocks
a /etc/X11/rgb.dir 8 blocks
a /etc/X11/rgb.pag 58 blocks
a /etc/X11/C/print/attributes/document 2 blocks


The -c option is used when creating a backup. You can also create a tar backup file on another file system instead of on a tape device. For this purpose, use a file name with the -f option instead of the device name. To create a tar backup of the /home directory in a file, /extra/home.tar, use the following command.

tar ├в cvf /extra/home.tar /home

To list the contents of a tar backup, use the -t option with the tar command. The following command lists the contents of a tape device.

tar ├в tvf /dev/rmt/0m

You can also use the command as follows, as /dev/rmt/0m is the default tape drive used by the tar command.

tar -tv



To restore data from a tar backup, use the -x option with the tar command. The following command restores data from a tape backup device.

# tar ├в xvf /dev/rmt/0m
x MANPATH, 279 bytes, 1 tape blocks
x PATH, 163 bytes, 1 tape blocks
x SHLIB_PATH, 9 bytes, 1 tape blocks
x SnmpAgent.d/snmpinfo.dat, 56769 bytes, 111 tape blocks
x SnmpAgent.d/snmpd.conf, 6959 bytes, 14 tape blocks
x TIMEZONE, 21 bytes, 1 tape blocks



Next,

Disk space utilization can be viewed with the help of the bdf command, which lists all mounted file systems and shows the following information about each file system.

file system name

total capacity in kilobytes

used capacity in kilobytes

available capacity in kilobytes

percentage of utilization

mount point

Output of this command is shown here.

$ bdf

Hope this helps!
Chandan
Learn. Share. Inspire.
Sivakumar TS
Honored Contributor

Re: Tar & lvm

Hi,

i) you can either use #tar -tvf /dev/rmt/0m to list of contents of a tape / use #tar -cvf to copy any files.

ii) You can login and delete any unwanted files to free-up some space.

With Regards,

Siva.
Nothing is Impossible !
Geoff Wild
Honored Contributor

Re: Tar & lvm

To get more space, you can extend the file systems....

Do a
vgdisplay -v /dev/vgXX
where XX is the number of your volume group...like say vg00

At the bottom, you will see the "--- Physical volumes ---" - look at "Free PE" - if there is some - then you can use it.

PE - Physical Extents - look at the "PE Size (Mbytes)" field - then multiply that by the "Free PE" to determine how many Mega Bytes you have available.

If you have onlinejfs ( swlist -l fileset |grep OnlineJFS ) then you can extend on the fly:

Say /var in lvol8, and you want to make it 2GB:

lvextend -l 2048 /dev/vg00/lvol8
fsadm -F vxfs -b 2048M /var

That's it.

If you don't have onliunejfs, you will have to unmount the filesystem, do the same lvextend, and then do an extendfs -F vxfs /dev/vg00/rlvol8

Rgds...Geoff


Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.