Sponsored Content
Top Forums Shell Programming and Scripting Help creating a script to relocate shares Post 302101848 by kenisswell on Friday 5th of January 2007 01:48:54 AM
Old 01-05-2007
Help creating a script to relocate shares

I have a single Linux Red Hat 8.0 server with two external disk arrays (each a raid) connected via SCSI. The OS/boot/swap is on an internal set of disks and should not be affected by this process.

I need to move all of my data from one disk array to another while keeping all of my 30 or so shares and permissions intact as possible. Each disk array is about 2000Gb and has a single partition/mount. Both disk arrays are connected and in production. Currently each disk array is less than half full so there is room to move all the data on to a single array thereby freeing up the other array. I have about 15 Samba shares on each array. My partitions are mounted as /data/sdc (array 1 ) and /data/sdd (array 2).

I need to remove arrays 2 for major maintenance. I could do all of these steps manually but I would like to script this process if possible (unless its not worth it).

My thought was to make a script that would do the following:

Manually
-create list of the shares and/or folders to be moved.
Script
-Read the list.
-Take the first Samba share offline (disabled if that is possible.)
-Copy (or move) the corresponding folder to the other partition.
-Edit the Samba config to reflect the new path of the share.
-Turn the corresponding share back on line (enable.)
-Once first share/move is done, move on to the next in the list. (loop this until complete.)
(-use verbose logging and pipe results to a log file.)
-Done.

The copying or moving of all the files will take quite a while but if I only do one share at a time I will minimize the impact on my users. Also I could kick off in the evening and have it hopefully complete on its own. I am not sure how it will deal with open or locked files.

I am not a programmer so I am not sure where to start. Any thoughts or existing scripts?

Thanks
Ken
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

File Server Pc Shares

Hi Everybody, I just want to know if anyone can help me to increase disk space for my users shared folder... it running out of free space... Any command that i can use or any otherway to prevent losing disk space from each folder? Please help... Thank you. (2 Replies)
Discussion started by: bvillante
2 Replies

2. Shell Programming and Scripting

help needed with creating challenging bash script with creating directories

Hi, Can someone help me with creating a bash shell script. I need to create a script that gets a positive number n as an argument. The script must create n directories in the current directory with names like map_1, map_2 etcetera. Each directory must be contained within its predecessor. So... (7 Replies)
Discussion started by: I-1
7 Replies

3. Red Hat

NFS Shares

Hi, Is there any command in linux to check the remote NFS shares from client machine just like we have dfshares in solaris. Thanks, Trimurtulu (1 Reply)
Discussion started by: ktrimu
1 Replies

4. UNIX for Dummies Questions & Answers

Samba - Creating shares

So I have Samba installed on my server and I have to create two shares. Make a backup of your smb.conf - call it smb.conf.orig. Create a share called shared that allows read and write permissions for everyone and points to /media/shared. Create another share called www that points to the... (1 Reply)
Discussion started by: shadowcat
1 Replies

5. Solaris

hard disk broken, relocate user's home dir. All setting missing

Hi, guys I am a super newbie in solaris admin.... Now I got a problem. Due to the broken of one of Raid system, some user home directory is missing. Someone advises me to relocate the home directory on the new drive. I have googled and have tried " usermode -d " command. But I found a... (3 Replies)
Discussion started by: dr_dw
3 Replies

6. Windows & DOS: Issues & Discussions

Script to automatically map samba shares as network drive

Hopefully someone will be kind enough to help me. I have a fileserver acting as a PDC and providing samba shares to a small network. Authentication to the PDC is via LDAP (setup using ebox) The users all have real local accounts on the server. I would like a windows logon script that will:... (4 Replies)
Discussion started by: barrydocks
4 Replies

7. SCO

Boot hang after relocate of LSI HBA controller

Hi folks, I had problems trying to install SCO OpenServer 6 on a PC with no floppy drive and a SATA CD drive. Eventually after advice received on this forum last week, I adopted a different approach by fitting the LSI HBA RAID adapter and associated disks into an older PC that does have CD and... (4 Replies)
Discussion started by: millosman
4 Replies

8. Red Hat

Help with NFS shares

Hi, I have got nfs shares that were shared from storage (Netapp) to linux servers (RHEL 4) that were on automount. All the share were visible and mounted on the linux serves eventhough they were on auto mount. But recently one of the server was rebooted and mount points were disappeard and... (5 Replies)
Discussion started by: phanidhar6039
5 Replies

9. UNIX for Advanced & Expert Users

File shares in UNIX

a) what are the different ways to share files ? b) How can I get list of file shares on Unix box in my company? c) How can I get list of files and their content present on all the Unix File shares? (1 Reply)
Discussion started by: vipintanwar
1 Replies
raidtab(5)							File Formats Manual							raidtab(5)

NAME
raidtab - configuration file for md (RAID) devices DESCRIPTION
/etc/raidtab is the default configuration file for the raid tools (raidstart and company). It defines how RAID devices are configured on a system. FORMAT
/etc/raidtab has multiple sections, one for each md device which is being configured. Each section begins with the raiddev keyword. The order of items in the file is important. Later raiddev entries can use earlier ones (which allows RAID-10, for example), and the parsing code isn't overly bright, so be sure to follow the ordering in this man page for best results. Here's a sample md configuration file: # # sample raiddev configuration file # 'old' RAID0 array created with mdtools. # raiddev /dev/md0 raid-level 0 nr-raid-disks 2 persistent-superblock 0 chunk-size 8 device /dev/hda1 raid-disk 0 device /dev/hdb1 raid-disk 1 raiddev /dev/md1 raid-level 5 nr-raid-disks 3 nr-spare-disks 1 persistent-superblock 1 parity-algorithm left-symmetric device /dev/sda1 raid-disk 0 device /dev/sdb1 raid-disk 1 device /dev/sdc1 raid-disk 2 device /dev/sdd1 spare-disk 0 Here is more information on the directives which are in raid configuration files; the options are listen in this file in the same order they should appear in the actual configuration file. raiddev device This introduces the configuration section for the stated device. nr-raid-disks count Number of raid devices in the array; there should be count raid-disk entries later in the file. (current maximum limit for RAID devices -including spares- is 12 disks. This limit is already extended to 256 disks in experimental patches.) nr-spare-disks count Number of spare devices in the array; there should be count spare-disk entries later in the file. Spare disks may only be used with RAID4 and RAID5, and allow the kernel to automatically build new RAID disks as needed. It is also possible to add/remove spares run- time via raidhotadd/raidhotremove, care has to be taken that the /etc/raidtab configuration exactly follows the actual configuration of the array. (raidhotadd/raidhotremove does not change the configuration file) persistent-superblock 0/1 newly created RAID arrays should use a persistent superblock. A persistent superblock is a small disk area allocated at the end of each RAID device, this helps the kernel to safely detect RAID devices even if disks have been moved between SCSI controllers. It can be used for RAID0/LINEAR arrays too, to protect against accidental disk mixups. (the kernel will either correctly reorder disks, or will refuse to start up an array if something has happened to any member disk. Of course for the 'fail-safe' RAID variants (RAID1/RAID5) spares are activated if any disk fails.) Every member disk/partition/device has a superblock, which carries all information necessary to start up the whole array. (for autodetection to work all the 'member' RAID partitions should be marked type 0xfd via fdisk) The superblock is not visible in the final RAID array and cannot be destroyed accidentally through usage of the md device files, all RAID data content is available for filesystem use. parity-algorithm which The parity-algorithm to use with RAID5. It must be one of left-asymmetric, right-asymmetric, left-symmetric, or right-symmetric. left-symmetric is the one that offers maximum performance on typical disks with rotating platters. chunk-size size Sets the stripe size to size kilobytes. Has to be a power of 2 and has a compilation-time maximum of 4M. (MAX_CHUNK_SIZE in the ker- nel driver) typical values are anything from 4k to 128k, the best value should be determined by experimenting on a given array, alot depends on the SCSI and disk configuration. device devpath Adds the device devpath to the list of devices which comprise the raid system. Note that this command must be followed by one of raid-disk, spare-disk, or parity-disk. Also note that it's possible to recursively define RAID arrays, ie. to set up a RAID5 array of RAID5 arrays. (thus achieving two-disk failure protection, at the price of more disk space spent on RAID5 checksum blocks) raid-disk index The most recently defined device is inserted at position index in the raid array. spare-disk index The most recently defined device is inserted at position index in the spare disk array. parity-disk index The most recently defined device is moved to the end of the raid array, which forces it to be used for parity. failed-disk index The most recently defined device is inserted at position index in the raid array as a failed device. This allows you to create raid 1/4/5 devices in degraded mode - useful for installation. Don't use the smallest device in an array for this, put this after the raid-disk definitions! NOTES
The raidtools are derived from the md-tools and raidtools packages, which were originally written by Marc Zyngier, Miguel de Icaza, Gadi Oxman, Bradley Ward Allen, and Ingo Molnar. SEE ALSO
raidstart(8), raid0run(8), mkraid(8), raidstop(8) raidtab(5)
All times are GMT -4. The time now is 08:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy