LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-09-2012, 11:29 AM   #1
piaakit
LQ Newbie
 
Registered: Aug 2011
Posts: 16

Rep: Reputation: Disabled
Question changing the Apache DocumentRoot path to new add additional hardisk


Hi

i have an problem regarding to change the default apache

path from "/var/www/html" to new add hardisk, the new add

hardisk http path i,m going to use is "/media/af3558aa-6786-43fa-b026-2c42df622795/http", i modify

the "/etc/httpd/conf/httpd.conf" and change

the path to "DocumentRoot /media/af3558aa-6786-43fa-b026-2c

42df622795/http/" and then to restart the httpd service, and

below error appeared "DocumentRoot must be a directory", is

it workable to change path to add new hardisk ? and this

linux rhel 6 64bit is a VM machine, the new add hardisk is

an additional vm storage added from esxi 5, any body have

idea ? thx

piaakit
 
Old 07-09-2012, 11:52 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Please show
Code:
fdisk -l  # lowercase L there

df -h

cat /etc/fstab
 
Old 07-10-2012, 01:23 AM   #3
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
I would safe me the hassle and just mount the new partition at the old DocumentRoot /var/www/html afte copying the files over to it. Then restart apache.
 
Old 07-10-2012, 02:36 AM   #4
piaakit
LQ Newbie
 
Registered: Aug 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
i,m new in linux, can you tell me the step to mount the new partition at the document root /var/www/html ?


fdisk -l

Disk /dev/sda: 64.4 GB, 64424509440 bytes
64 heads, 32 sectors/track, 61440 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007cc9c

Device Boot Start End Blocks Id System
/dev/sda1 * 2 501 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 502 61440 62401536 8e Linux LVM
Partition 2 does not end on cylinder boundary.

Disk /dev/sdb: 171.8 GB, 171798691840 bytes
255 heads, 63 sectors/track, 20886 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a2f79

Device Boot Start End Blocks Id System
/dev/sdb1 1 20887 167771136 83 Linux

Disk /dev/dm-0: 30.7 GB, 30689722368 bytes
255 heads, 63 sectors/track, 3731 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 31.1 GB, 31092375552 bytes
255 heads, 63 sectors/track, 3780 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-2 doesn't contain a valid partition table























[root@061092137050 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
29G 7.9G 19G 30% /
tmpfs 499M 148K 499M 1% /dev/shm
/dev/sda1 485M 32M 428M 7% /boot
/dev/mapper/VolGroup-lv_home
29G 216M 27G 1% /home
/dev/sr0 3.2G 3.2G 0 100% /media/RHEL_6.0 x86_64 Disc 1
/dev/sdb1 158G 188M 156G 1% /media/af3558aa-6786-43fa-b026-2c42df622795






[root@061092137050 ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Sat Jul 7 10:01:53 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1
UUID=18843e83-db6f-4f2e-a84f-dc22277744e3 /boot ext4 defaults 1 2
/dev/mapper/VolGroup-lv_home /home ext4 defaults 1 2
/dev/mapper/VolGroup-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
 
Old 07-10-2012, 02:46 AM   #5
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Try the following
Code:
mount UUID=af3558aa-6786-43fa-b026-2c42df622795 /var/www/html
Just have in mind that all the files that are under /var/www/html are masked by the new mount and can't be accesed until the new mount is umounted again.
 
Old 07-10-2012, 03:25 AM   #6
piaakit
LQ Newbie
 
Registered: Aug 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
if i mount it like this, it will use the new add hardisk's storage ?
 
Old 07-10-2012, 05:37 AM   #7
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Yes. Read up on the mount command. And maybe filestructure or filesystem under linux in generell.
The mount command takes two arguments. One is the device in your case given with the UUID and the path inside the filesystem where the new device should be accessible at. Just do a df -h before the mount and after the mount and you will see the difference.
 
Old 07-10-2012, 07:38 AM   #8
piaakit
LQ Newbie
 
Registered: Aug 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
How come that I can not direct chagr the document root path from original to new add hardisk, is it because of partition issue ?
 
Old 07-10-2012, 08:24 AM   #9
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
You sure could use the new path for the docroot. There are just many ways to do things.
My guess is that the path your using as the new DocumenRoot isn't there yet. Did you create it?
Please give the output of
Code:
ls -lh /media/af3558aa-6786-43fa-b026-2c42df622795
In case the dir is not there yet do a
Code:
mkdir /media/af3558aa-6786-43fa-b026-2c42df622795/http
Just another thing to remark is that after everything works you should enter the /media/af3558aa-6786-43fa-b026-2c42df622795/ mount into your /etc/fstab file
 
Old 07-10-2012, 09:17 AM   #10
piaakit
LQ Newbie
 
Registered: Aug 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
The destnation path is already exist, It is a new add hardisk from vm, and I will show u the output when I get home
 
Old 07-11-2012, 07:57 AM   #11
piaakit
LQ Newbie
 
Registered: Aug 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
below is the output

ls -lh /media/af3558aa-6786-43fa-b026-2c42df622795
total 24K
drwxr-xr-x. 2 root root 4.0K Jul 8 17:51 abcd
drwxrwxrwx. 2 root root 4.0K Jul 10 00:07 http
drwx------. 2 root root 16K Jul 8 17:42 lost+found
 
Old 07-11-2012, 08:25 AM   #12
piaakit
LQ Newbie
 
Registered: Aug 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
although i mount the drive but still showing this message

"DocumentRoot must be a directory"
 
Old 07-11-2012, 11:59 AM   #13
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Hm, tough one. So the directory exists but apache is still complaining. Last shot of me would be a typo.

Okay lets try this. Change the DocumentRoot back to its original value (/var/www/http it was?), restart apache. This is too make sure that we have a generel sane configuration.
After that make extra to get path right. cd into the /media/uuid/http directory and use the command pwd to print the working directory. Copy that and paste it into the apache configuration as the value for DocumentRoot.
Or maybe you can mount the new disk under a simpler directory. Something like /media/new_disk. This way you can nearly rule out typos.
 
Old 07-12-2012, 03:15 AM   #14
piaakit
LQ Newbie
 
Registered: Aug 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
Hi

mount the new disk under a simpler directory (can you show me how to do that ?) ,& how to get rid of the uuid display in \media\uuid of a new drive ?

keith
 
Old 07-12-2012, 07:22 AM   #15
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Okay some explanation for names a disk partition can be addressed through.
You can use the name of the partition like it is under /dev. In your case this should be /dev/sdb1 if I read your fdisk -l output correct. (Using dev names may lead to errors cause the bios might rearrange the order harddrives are named during reboots).
Or can use the uuid of the partition. Use the blkid tool to get it. Or use tune2fs -l /dev/devicename
Or one can use a label when creating the filesystem.

Now to mount (You did have a look at man mount, didn't you )
mount needs a device and a path. The opposite command is umount and it only needs one of the options you used when mounting a device. So you could unmount the drive either by specifying the path where its mounted or use the device name. For ease use
Code:
umount /dev/sdb1
After unmounting the drive you can mount it like this
Code:
mount /dev/sdb1 /media/new_disk
and the new disk will be available under /media/new_disk/. AS long as the directory exists.

HOw to get rid of the /media/uuid thing should be some options for udev. But I'm not sure about it. Did the disk got automounted after adding the new disk through VM?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache: Serving files Outside the set DocumentRoot Path compused Linux - Software 2 03-14-2012 06:13 AM
Add an additional service account to Apache??? wyattbiker Linux - Software 2 12-31-2011 10:04 AM
Changing Apache Path veeraa2003 Linux - Server 1 01-23-2007 05:39 AM
Apache is giving me 403 when changing DocumentRoot Lazy Foo' Linux - Software 7 01-30-2006 08:39 PM
Changing Apache DocumentRoot walterbyrd Linux - Software 1 10-18-2005 03:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration