Showing posts with label Linux FileSystem. Show all posts
Showing posts with label Linux FileSystem. Show all posts

Monday, September 06, 2010

tar Magic

Tar is commonly used for packaging files on Linux. Tar uses many command-line options like following:

-f    To use a tarfile
-c   To create a new tarfile
-x   To extract files from a tarfile.

You also can compress the resulting tarfile via two methods. 
-j    To use bzip2
-z    To use gzip

You can tar up a directory and all of its subdirectories by using:
tar cf archive.tar dir

Then, extract it in another directory with:
tar xf archive.tar

When creating a tarfile, you can assign a volume name with the option -V . You can move an entire directory structure with tar by executing:
tar cf - dir1 | (cd dir2; tar xf -)

You can move an entire directory structure over the network by executing:
tar cf - dir1 | ssh remote_host "( cd /path/to/dir2; tar xf - )"

If you want to get a dump of your current filesystem to a secondary hard drive, use (as root):
tar -cvzf /dev/hdd /

If you are writing your tarfile to a device that is too small, you can tell tar to do a multivolume archive with the -M option.

You can back up your home directory to a series of floppy disks by executing:
tar -cvMf /dev/fd0 $HOME

If you are doing backups, you may want to preserve the file permissions. You can do this with the -p option. If you have symlinked files on your filesystem, you can dereference the symlinks with the -h option. This tells tar actually to dump the file that the symlink points to, not just the symlink.

Along the same lines, if you have several filesystems mounted, you can tell tar to stick to only one filesystem with the option -l.

Friday, August 27, 2010

NTFS File Access Inside FEDORA CORE

Well this is a basic topic on allowing NTFS file access inside Fedora Core. NTFS is a file system used on Windows 2000, and Windows XP mainly. If you wish to access the data on these drives whilst inside Linux, firstly you need to install a module that is the ntfs.ko. This allows the kernel to read the NTFS partitions. Then u will need to locate and download the right RPM (FC users) for your system from http://www.linux-ntfs.org/content/view/187/. Look through the list, and search for your kernel version. To know your kernel version type: uname -r
Newer NTFS RPMs have names like
kernel-module-ntfs-2.6.8-1.541-2.1.17-0.fc.1.2.i586.rpm
When downloading the RPM save it to disk, and do not run using the install package manager. Go to where you saved the RPM, and at the command line (in the directory where the RPM is stored) .To install the RPM: rpm -ihv *.rpm
You should see:
Preparing...      ############################### [100%]
1:kernel-ntfs  ############################### [100%]

/sbin/modprobe ntfs

There should be no output. If there is a lot of error messages see the Help Section on http://www.linux-ntfs.org/content/view/124/60/

Do the following for configuration:

1. Login as root by running from a terminal su followed by typing the root password.

2. Create a directory in your /mnt folder. This can be done by running mkdir /mnt/X where X is the name of the directory where the NTFS partition will be mounted.

3. /sbin/fdisk -l This will output your HPFS/NTFS partition identifier. Lets say the device file name is found to be /dev/Y.

4. gedit /etc/fstab . Gedit will open

5. On a new line at the bottom of the file, add the line

/dev/Y /mnt/X ntfs ro,defaults,umask=0222  0 0

where X is the name of the directory you created in step 2.

6. Save and quit the file /etc/fstab

7. Then run mount -a (or some say mount -t ntfs /dev/hdb1 /mnt) and the NTFS partition will be mounted. It will also be mounted automatically after reboot so that you do not have to do anything after you reboot.