Programming :: Indexing Multiple Drives With Perl?

May 7, 2010

I have 4 separate drives, all un-RAIDed.Each drive has almost the same root directories, but different contents in each folder.

For example:

/mnt/sda/TV Shows/Lost/
/mnt/sdb/TV Shows/Your_Favorite_Show/

The goal is to have a single folder that has symlinks to all the files in each of the drives. Pretty much a poor man's JBOD. Previously, I had problems with conditions like 2 drives having the same sub folder contents, but I ended up solving that with the current script I'm using now.What I'm looking for now is speed. I'm very new to Perl and the script takes about 12 minutes to complete with the current drives.

Basically, the script makes a list of all directories and files in each drive. First, it makes the directories. I didn't use any validation because if a directory already exists, it simply won't make one. However, with the files, I used a hash to only keep the unique files. Then I use the key/value pairs with ln to create every link to the files only, not directories.

Code:

#!/usr/bin/perl
use warnings;
my @drives_to_sync = qw ( /mnt/sda/ /mnt/sdb/ /mnt/sdc/ /mnt/sdd/);

[code].....

View 2 Replies


ADVERTISEMENT

Programming :: Delete Multiple Lines In A File Using Perl?

Apr 15, 2011

I have a file looks like the following:

digraph topology
{
"192.168.3.254" -> "10.1.1.11"[label="1.000", style=solid];
"192.168.3.254" -> "10.1.1.12"[label="1.000", style=solid];

[code]...

Order of these lines are random... So I cannot delete line #19, for example... And you can see that top four lines I want to delete are pairs. So there might be some clever way to detect the lines, if a line has both "1.9" and "1.11", then delete the line... I am new to perl language. The following is the code I have now... I think I just need to write some code inside the while loop checking if I want to delete the line $dotline before I write to a NEW file.

Code:

#!/usr/bin/perl -w
$TOPPATH = "/tmp";
$NAME = "topology";
$FILENAME = "$TOPPATH/$NAME.dot";

[code]....

View 16 Replies View Related

Programming :: Perl - Multiple Child Processes In Parallel?

Sep 3, 2010

I'm looking for a way in Perl to be able to take a list of servers, ssh multiple commands to it and store the results. If I do this process serially, sometimes one server will hang the whole script and if it doesn't, it still takes hours to complete.

I'm thinking what I need to do is make a parent loop that calls out a separate process that passes the server name to the child sub process and then executes all the commands I have defined in its own process. If one server 'hangs', at least that won't stop the script from doing all the other servers in the list.

I'm guessing using the fork() command would serve me best, however, all the online descriptions I have found have been vague at best.

View 4 Replies View Related

Programming :: Unable To Match Across Multiple Lines In Perl

May 11, 2011

I'm trying to split a text file into various parts. Everything in between "123" and "break" (including linebreaks) goes into the splitted file.

e.g. using this text file:

This should split into 4 files. However I'm only getting 2 files: one for the line "123break" and one for "123 blah break". The two occurrences that contain linebreaks are being ignored. The .* part of my match should capture linebreaks seeing that I'm using the /s modifier shouldn't it? Even when I use the match /(123 break)/gs it still doesn't capture the first occurrence. I'm using Perl v5.12.3 (from ActiveState) on Windows XP. The text file is also in Windows format.

Code listed below.

The above code generates two files Output_1.txt and Output_2.txt which contain "123break" and "123 blah break" respectively. I want it to generate four files.

View 4 Replies View Related

Programming :: Convert Multiple File In Directory - Ascii To Hex In Perl ?

Apr 9, 2011

I have found a perl script that can convert single file: ascii to hex.

However I have thousand of file that I want to convert from ascii to hex.

Here is the perl script that convert single ascii file to hex in single line:

Quote:

So I would like to read multiple file from a directory.

Then the file will be have same name file with hex data.

Here is sample of the read and write directory file.

Quote:

View 3 Replies View Related

Programming :: Perl Regex Not Matching Across Multiple Lines Despite Ms Flags / Fix It?

Aug 16, 2010

I have written a regular expression (tested in regexpal and regextester alpha something) with which I want to replace something like code...

but it only matches functions which occupy one line only, despite my tests showing multiple line matching in javascript testers online and using the m and s flags (which should make it multi line no?)

View 14 Replies View Related

Programming :: Perl's Length() Counts Umlauts Multiple Times

Dec 14, 2010

I'm programming some skript to get statistical information about some texts. This includes calculating the mean of word lengths.Unfortunately, Umlauts count as two characters. In the example below the output is 9, it should be 6.

sincercly, Max

Code:
#!/usr/bin/perl
use POSIX;
use locale;
my $test = length("ABC���");
print $test;

View 4 Replies View Related

Programming :: [Perl] Fail To Sort A File With 300,000 Lines By Multiple Columns?

Nov 10, 2009

Each line of the file I am sorting is in the following format:

<url> <month> <day>

For example:

[URL]

I wrote the following to sort:

Code:

#!/usr/bin/perl
$in = shift;
chomp($in);

[code]....

The script worked fine for my small testing files, but failed in my input file. The input file is 18MB and containing more than 300,000 lines. The output will contains some lines like that:

url_one 10 1
url_two 10 1
url_three 10 3
url_four 10 1

Is that because my file is too big for perl to handle ?

View 10 Replies View Related

Programming :: Split A File To Multiple File Using Awk Or Perl?

Feb 27, 2011

I have a single file that contain multi-text something likes this:

Quote:

No. Time Source Destination Protocol Info
185 27712.068199 192.168.18.23 192.168.18.191 SMTP S: 250 2.1.5 Ok
No. Time Source Destination Protocol Info
186 27715.068293 192.168.0.50 192.168.5.2 TCP suncacao-jmxmp > 44693 [ACK] Seq=1 Ack=1 Win=64807 Len=1380

[Code].....

View 14 Replies View Related

General :: Files That Span Multiple Drives Drives?

Jan 8, 2010

So, at the moment I have a 7TB LVM with 1 group and one logical volume. In all honesty I don't back up this information. It is filled with data that I can "afford" to lose, but... would rather not. How do LVMs fail? If I lose a 1.5TB drive that is part of the LVM does that mean at most I could lose 1.5TB of data? Or can files span more than one drive? if so, would it just be one file what would span two drives? or could there be many files that span multiple drives drives? Essentially. I'm just curious, in a general, in a high level sense about LVM safety. What are the risks that are involved?

Edit: what happens if I boot up the computer with a drive missing from the lvm? Is there a first primary drive?

View 10 Replies View Related

Programming :: Indexing Variables In Lists Using Shell Scripts?

May 27, 2010

I have a question concerning indexing over lists with unix shell scripts. I have very large text files (up to 20 Gb) with the data shown below:

80011412865610
43000216943210
4710510513101

[code]...

View 14 Replies View Related

General :: Write A Perl Script To Ping Multiple Server?

Jul 22, 2011

How to write a perl script to ping multiple server and if any server is down then we manually bring up the server within 3hours wehn it goes down and will display a message" server is up within 3hours" and if we are unable to bring the server up manually within 3 hours then we will display a message " unable to bring the server alive". Need perl script to display the message.

View 1 Replies View Related

Ubuntu :: Using Multiple Hard Drives?

Apr 29, 2011

My computer has 2 40GB hard drives (yes, it's really old). One of these hard drives has Ubuntu installed on it, and I would like to use the second hard drive as a data storage device that is usable by anyone who just wants a random place to drop random stuff. How do I do this?

View 2 Replies View Related

Installation :: Multiple OS On Two Hard Drives

Mar 18, 2009

i am new in Linux. i have two drives one IDE and other SATA in my computer.i want to keep windows XP , WIndows 2003 server on one drive and two flavours of linux on the other drive, let say oopen suse and redhat.please help me how i install these sofwares to make multi boot the machine.

View 2 Replies View Related

General :: Multiple Booting From Two Drives?

Oct 21, 2010

I installed three O.S on one drive. I disconnected this drive and installed two more OS's on the the next drive. On the first drive all three were bootable and on the second only the first O.S. would boot. The second drive booted both O.S at first and then stopped. I used a rescue disk on the second drive with two on it and it made no difference. I did the same to the first drive and I sort of joined the to boot loaders together in a non appreciative way.

Is is practical to do what I tried doing and should I just multiboot off one drive? I would like about eight O.S's on the same computer.

View 9 Replies View Related

Ubuntu :: Multiple Flash Drives For Storage?

Jan 4, 2010

I am running Karmic on a stripped laptop, and running it off a usb thumbdrive.Its purpose is mainly as a slide show/video show inset in a tableI did not really want to go out and buy a HDD, since it does not need to store that much. Then I went to aldi and they had 8gb flash drives for $5, so I got 6. The ultimate question comes down to the best way to make use of them. I ordered a 7 slot USB hum off ebay for cheap, and I was going to go from there. would it be easier/better to just plug them in and make links to them from the normal folders and just operate directly from there, or is there a better option. I guess a usb raid array could be neat

View 4 Replies View Related

Ubuntu Servers :: Getting Grub On Multiple Drives?

Jun 6, 2010

(tangent to my other thread "Karmic -> Lucid not booting"). I have four hard drives on a Lucid box, and (as it happens) the fourth drive is the boot and root. Could I also install grub on the other three (ext4) hard drives, keeping the same root? Will this disturb the data there? How would the machine decide which copy to use, anyway?

View 2 Replies View Related

Ubuntu Servers :: Use Multiple Hard Drives As One

Oct 9, 2010

I have a second hard drive that I plan on placing in a computer I wish to use this computer as a server so my question is how could I use these 2 hard drives as one lets say one is 80Gb and the other is 40GB how could they be shown as 120GB instead of being seperate The installation of server planned on being used is 10.04.

View 7 Replies View Related

Ubuntu :: Use Multiple USB Drives To Provide RAID ?

Dec 14, 2010

I've got a 10.10 installation, which I am using as a media/download server. Currently everything is stored on a 1TB USB drive.With the costs of disks falling, and the hassle of trying to back 1TB up to DVD (no, it's not going to happen) I was wondering if there's some linux/Ubuntu utility, which can use multiple disks to provide failover/resilience ... Could I just buy another 1TB drive, and have it "shadowing" the main, so that if one goes, I buy another, and then restore from the copy ?

View 3 Replies View Related

Ubuntu :: Filezilla / FTP Multiple Hard Drives

Mar 25, 2011

I am running Ubuntu on a box with a couple of hard drives, and on a network where we have another Ubuntu machine and a couple of windows boxes. I use filezilla to upload files to other web servers but filezilla will only access files on my main hard drive, not on the second drive and not on the rest of the network.

View 1 Replies View Related

Ubuntu :: F-Spot With Multiple Hard Drives?

Apr 19, 2011

I am just trying F-Spot because a novice ubuntu friend needed help. ubuntu 10.04.2. As a test, on my PC, I have pasted some photos into a particular test folder in my current Ubuntu (in my user folders). I have also nominated a folder as a destination for imported photos. After starting F-Spot, I try to use the test (source) folder in F-Spot with the intention of importing the test photos.

I am using a PC with three hard drives. One has various distros installed, mostly ubuntu versions, all in their own partitions. The other two hard drives are ones I use for data, including backups. They are both continuously mounted. However, the import 'file finder' facility only lists the two data drives, it does not list the current home user folders, which is where my test (source) folder is(!!!)

View 1 Replies View Related

Ubuntu :: Seting Up Multiple Hard Drives?

Jul 13, 2011

I am thinking of building a new computer. I have been using Ubuntu for a couple years now, but I am not good with the terminal usage. Nevertheless, if I was to go back to Windows I be lost. My Computer would be:

Motherboard = Micro ATX
Hard Drive 1 80GB = Operating System
Hard Drive 2 250GB = Home (my documents)
Hard Drive 3 500GB = Media (videos, music & pictures)

I would like the file to end up on the desired hard drive automatically. And my main menu to display accordingly. In other words, when I click over music, under places in my computer menu, for the computer to know which hard drive to go to. The reason for wanting this setup is, to provide security for the OP, separate my private documents from my music and videos. Now I am using external hard drives. But, it just do not look right, besides the menu is funky.

Would I have to use a RAID set-up or just the partition tool. Does anyone knows of a post or tutorial on how to accomplish this? (plain English would be better).

View 3 Replies View Related

Ubuntu :: Install On Multiple Hard Drives?

Sep 1, 2011

I am doing a new build with an SSD / HDD combo, and I am wondering, is there a way I can install Ubuntu spread across both drives? I know I can do this in Fedora, but I haven't seen much of a feature like this in Ubuntu.

View 9 Replies View Related

Programming :: Socket Programming In Module Perl

Jul 21, 2010

Where is the perl module for programming with sockets?

View 4 Replies View Related

Debian :: Mount Multiple External Hard Drives ?

Dec 20, 2010

How to mount multiple external HDD's. I'd like to link or mount the music, torrents, and general files from several external hard drives and apply permissions (in some cases I only want the mount or link to be read only).

My setup:
- Seagate Dockstar running Debian squeeze (it's headless so I don't have a gui running)
- Two external HDD's with one partition on each (250GB and 400GB)

What I'd like to accomplish:
1. Mount the external HDD's to /media/HDDs as read/write (this is already working using udev and autofs and it's available in samba)
2. I'd like the MUSIC directories on both external HDD's to show up under the same mount point. In other words I want the MUSIC folders (from both HDD's) to appear as one large library of music. And I only want this to be readonly. It will be used as the library for mpd and/or squeezebox.
3. Mount a directory used to download torrents to. I'll probably pick on HDD as the target for torrent dowloads. But let me know if you have any other ideas regarding this.

Since I have the first one done, how would I accomplish 2 & 3?

View 1 Replies View Related

Ubuntu :: Give Multiple Users Access To Drives?

Aug 11, 2010

I just created a 2nd user on my computer. I've got the hard drive that ubuntu runs on, and then a 2tb drive for media. If the 2tb is mounted on my desktop, it won't show up on his desktop even if I'm logged out. It won't show up on his unless I unmount on mine.

If I'm logged out I'm obviously not using it. So why doesn't it show up? He has all privileges. Is there a way to make this work without having to unmount?

I'm running karmic btw. If you need computer info let me know what to type into the terminal and whatnot and I'll paste it all here!

View 4 Replies View Related

Ubuntu Installation :: Installing 10.10 With Multiple Hard Drives?

Dec 27, 2010

I have been trying to install Ubuntu on my new computer as a duel boot with Windows 7. My computer has four 1TB hard drives, One with Windows 7 installed, two that are used for storing media (both are independent, not in a RAID or anything like that) and one empty hard drive. This hard drive contains a 901.51 GB NTFS partition, and 30.00 GB of Unallocated space, I wish to install Ubuntu in this unallocated space; giving it 20 GB (the 10 GB left over might be used for installing XBMC Live). But when I boot Ubuntu's Live CD the installer doesn't show me the unallocated space, and doesn't really show me any of the extra Hard drives.

View 3 Replies View Related

Server :: Setting Up Network Share With Multiple Drives

Aug 12, 2009

I have what will soon become a file server here running Mandriva 2009.1 and I need to set it up for use. There are 6 physical drives, sda-sdf. According to my fstab (pasted below), the OS is installed on sdb.. and for some reason I have a swap partition on sda and sdb. I had a horrible time getting a working installation, and that's probably leftover from a previous attempt.

Question 1: Can I simply edit my fstab to remove the swap on sda, effectively confining all system resources to sdb? The end result I want is all storage space over all drives accessible from a single mount point which can be accessed over the network.

Question 2: Once I sort out the weird fstab, what's the best way to go about setting this up? I imagine I need to format & partition the other drives (all but sdb).. but as far as organizing the free space, what's the best way? Is it possible to have multiple physical drives accessible from a single mount point? Or will the users have to use each drive separately? I was thinking I could create a directory on sdb (in /home?) to use as a root for the network share, and then automount the other 5 physical drives there. Does that make sense?

Code:
/etc/fstab:
# Entry for /dev/sdb1 : UUID=7461ae34-aaa1-443d-82e1-fc9000afcc42 / ext3 relatime 1 1
# Entry for /dev/sdb6 : UUID=41535e04-0368-4682-ab9c-5f791bfea803 /home ext3 relatime 1 2
/dev/cdrom /media/cdrom auto umask=0,users,iocharset=utf8,noauto,ro,exec 0 0
none /proc proc defaults 0 0
# Entry for /dev/sda5 : UUID=9edbc49b-302c-43c8-8264-ed49a7f1fff2 swap swap defaults 0 0
# Entry for /dev/sdb5 : UUID=b7039857-dfae-4a92-8ff4-9d1cdcf25351 swap swap defaults 0 0

View 5 Replies View Related

Ubuntu Installation :: Setting Up GRUB2 With Multiple Hard Drives ?

Jul 28, 2010

I have been trying to move away from Windows2000 on Ubuntu for months. I have a few applications that I run on Windows that I have been unable to find usuable equivalents on Ubuntu eg Outlook/Mobile sync application required for my job and a DVB TV card application for home. So it looks like I am stuck ruuning W2K and Linux for at least a while and indeed I have been using GRUB2 to select between W2K and Ubuntu.

I need some basic advice about setting up GRUB2. My philosphy when it comes to PC data is you can never have enough backups and I avoid any single point of failure. So I have always used two hard drives which I keep in sync almost daily with FreeFileSync. I also swap my most critical encrypted data between a laptop and desktop. Then I also alternate external USB drives stored away from my home.

My current partions are

When I installed on the Ubuntu 500GB I let it & GRUB2 take the default options so it boots from Hd1 and I assume certain executables are stored at the begining of the Ubuntu partition as well as configuration files in its file system.

Now I'm replacing the 500GB with a 1.5TB and the old 500Gb will become my backup drive. I want to keep the backup drive bootable in its onw right. If either hard drive fails I want a bootable system and acccess to my data.

So my plan is to use the following partitions.

I can install W2K on the 1.5Tb from scratch or use Acronis to restore an image file. Then I can install Ubuntu from scratch.

OK now for my questions.

1) Can I get GRUB2 to put its executables and configuration files on a small partition of its own? I see no reason why they should be dependant on a specific Ubuntu partition. I have read posts mentioning this but not sure if this has to be a bootable Linux or just a file system with the config files.

2) Can I run update-grub on any Linux and store or copy the config files to the partition in 1?

3) I will use BIOS to determine which hard drive is first to boot. When I run update-grub (or when it runs during the new Ubuntu install on Hd1) I dont want GRUB2 to do anything with Hd2, not even know Hd2 exists, it that an option?

View 4 Replies View Related

Ubuntu Installation :: Booting With Grub With Multiple Hard Drives?

Jan 23, 2011

I have 3 hard drives installed to my system, 1TB, 2TB and 500GB drives with the following configuration:

ledi@ledi-ubuntu:~$ sudo parted /dev/sda print
Model: ATA SAMSUNG HD103UJ (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

[Code]...

I can boot to the Ubuntu installation in the 2TB drive. My problem reversed when I reinstalled grub to one of the Ubuntu installations in the 1TB drive. I can boot to any of the OS's in the 1TB drive, but not to the Ubuntu in the 2TB drive. The error message is the same as above. I have no idea what am I doing wrong and I would be really grateful for any assistance.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved