Help creating a script to relocate shares


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help creating a script to relocate shares
# 1  
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
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
Login or Register to Ask a Question