blog.up-link.ro
24Nov/110

UNIX Tips: How to find broken symbolic links

In computing, a symbolic link (also symlink or soft link) is a special type of file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.

1. To display a list of the broken links, execute:

find -L ${dir} -type l

2. To remove the broken links, execute:

find -L ${dir} -type l -print0 | xargs -0 rm
Do not forget to replace ${dir} with the desired directory.

Print This Post Print This Post


23Nov/110

Linux: How to shrink a Logical Volume with LVM

LVM is a logical volume manager for the Linux kernel. It manages disk drives and similar mass-storage devices, in particular large ones. The term "volume" refers to a disk drive or partition thereof. LVM was originally written in 1998 by Heinz Mauelshagen, who based its design on that of the LVM in HP-UX.

The LVM can:
- Resize volume groups online by absorbing new physical volumes (PV) or ejecting existing ones.
- Resize logical volumes (LV) online by concatenating extents onto them or truncating extents from them.
- Create read-only snapshots of logical volumes (LVM1).
- Create read-write snapshots of logical volumes (LVM2).
- Stripe whole or parts of logical volumes across multiple PVs, in a fashion similar to RAID 0.
- Mirror whole or parts of logical volumes, in a fashion similar to RAID 1.
- Move online logical volumes between PVs.
- Split or merge volume groups in situ (as long as no logical volumes span the split). This can be useful when migrating whole logical volumes to or from offline storage.

In this article I'll show you how to shrink a LVM Volume Safely.

Print This Post Print This Post
15Nov/110

Linux Tips: How to force fsck on the next reboot or boot sequence

fsck is a file system consistency check and interactive repair tool.
Here is a quick tip that will show how you can tell your Linux system to perform a fsck on its partitions on the next reboot. Normally this will happen by default, after some time as configured in the filesystem at creation time (or changed later): after a number of days or a number of filesystem mounts.

If for some reason, you want to force the system to run fsck on the next reboot just use one of the following options:

Print This Post Print This Post
2Nov/110

Linux: How to mount SMB/CIFS shares under Linux

This document provides help on mounting SMB/CIFS shares under Linux.
All files accessible in a Linux and UNIX systems are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree.

Use the mount command to mount remote SMB/CIFS shares under Linux as follows:

mount -t cifs //192.168.1.1/mySharedFolder -o username=myUser,password=myPassword /mnt/mySharedFolder

Where,
-t cifs : File system type to be mount
-o : are options passed to mount command, in this example I had passed two options. First argument is the user name (myUser) and second argument is the password (myPassword) to connect to the remote computer.
//192.168.1.1/mySharedFolder : remote computer and share name
/mnt/mySharedFolder : local mount point directory

Make sure to create /mnt/mySharedFolder first.

Print This Post Print This Post