Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using a pre-made social networking script where all user uploads go to site.com/public/user/

How can I make /public/user/ my secondary hard drive so all user uploads are uploaded to my second harddrive and not the primary hard drive. I have over 100GB of images, and I want them on my other HDD now. Thank you.

I am running CentOS 5.5 64bit w/ Apache and PHP

I have two 250GB Sata HDDs

#sudo parted /dev/sda print

Model: ATA WDC WD2500KS-00M (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      32.3kB  107MB   107MB   primary   ext3         boot 
 2      107MB   8595MB  8488MB  primary   linux-swap        
 3      8595MB  10.7GB  2147MB  primary   ext3              
 4      10.7GB  250GB   239GB   extended                    
 5      10.7GB  250GB   239GB   logical   ext3              

Information: Don't forget to update /etc/fstab, if necessary.    
5 10.7GB 250GB 239GB logical ext3
share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

The procedure would look something like this. You haven't provided much in the way of detail in your question, so I can't give you exact details.

  • If the other drive is new, or never been used, then you need to set it up. Create the partition and filesystem, then mount it somewhere.
  • Create a folder on your other drive /otherdrive_mnt/site.com/public/user/
  • Copy or move content from current location to the created folder
  • Link the folder to the new drive by
    • Creating a symlink from site.com/public/user/ to /otherdrive_mnt/site.com/public/user/
    • Use a bind mount from site.com/public/user/ to /otherdrive_mnt/site.com/public/user/
share|improve this answer
    
You don't need a symlink: just mount to a temporary directory to copy the files, then (after making sure that /public/user is completely empty) mount it to /public/user. And don't forget to update your fstab so it gets automatically mounted when you boot. –  Michael Lowman Jan 7 '11 at 18:20
    
Thank you! I am transferring to a new server, so I can just transfer all 100GB of images to the new server/secondary HDD. I am assuming my second HDD is " 4 10.7GB 250GB 239GB extended" is extended mean it's already partitioned, or do I still need to partition it? –  Andrew Fashion Jan 7 '11 at 18:33
add comment

The way I would do this would be to

  • Find out where site.com/public/user lives within the filesystem.
  • Partition and newfs the second drive as required
  • Temporarily mount the second drive somewhere and copy the existing files to it.
  • Disable uploads temporarily
  • Unmount the second drive and mount it into the filesystem as noted above
  • Enable uploads
  • Make a suitable entry in /etc/fstab
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.