LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-07-2012, 09:24 AM   #1
mmorton89
LQ Newbie
 
Registered: Jul 2012
Location: Columbus, OH
Distribution: Centos 6.3
Posts: 20

Rep: Reputation: Disabled
How can I move my /var directory to my 2nd hard drive?


I have been searching around the past 2 days trying to figure out how to move my /var directory to my 2nd HDD.

I really can not figure this out and all the pages google brings me to are "How to move your /home directory to its own disk partition". Which is not what I am trying to accomplish here.

I'm not sure what kind of information you would need to help me out but I will post my disk partitions.

OS - Centos 6.3

Code:
[root@localhost ~]# fdisk -l

Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 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: 0x000dce01

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       15567   124521472   8e  Linux LVM

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000bd256

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       60802   488385536   8e  Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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/mapper/VolGroup-lv_swap: 8422 MB, 8422162432 bytes
255 heads, 63 sectors/track, 1023 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/mapper/VolGroup-lv_home: 565.5 GB, 565501231104 bytes
255 heads, 63 sectors/track, 68751 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Let me know if you need any other additional information and thank you.
 
Old 11-07-2012, 09:43 AM   #2
shahinism
LQ Newbie
 
Registered: Aug 2012
Distribution: Slackware
Posts: 15

Rep: Reputation: Disabled
If you want to install a Linux system in partitioning step just make a partition there and make a mount point for it like /var.

And if you have a installed Linux system, it's easy as make a partition in the second hard drive you want. then copy your exiting /var files into it and at last modify your /etc/fstab file to automatically mount your new partition as /var directory.
I didn't really test it. but it has to be easy like this ;-)
 
Old 11-07-2012, 09:48 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Following links may be helpful:
(1) http://www.linuxquestions.org/questi...d-disk-745489/
(2) http://how-to.linuxcareer.com/learni...ux-commands-dd

(Note: Before taking any actions, don't forget to take backup your important data.)
 
Old 11-07-2012, 10:04 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
It appears the entire drive is being used as a LV for /home.
Since the entire drive is an LVM partition it isn't as simple as just creating another partition or copy using the dd command.

If /home uses the entire disk space then you will need to:
Resize the filesystem
Resize the LV
Create a new LV
Format the new LV
copy data from the old /var to the new /var
Edit /etc/fstab to add /var LV.

Boot up using the installation disk to the rescue mode.

Last edited by michaelk; 11-07-2012 at 10:06 AM.
 
1 members found this post helpful.
Old 11-07-2012, 11:17 AM   #5
mmorton89
LQ Newbie
 
Registered: Jul 2012
Location: Columbus, OH
Distribution: Centos 6.3
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
It appears the entire drive is being used as a LV for /home.
Since the entire drive is an LVM partition it isn't as simple as just creating another partition or copy using the dd command.

If /home uses the entire disk space then you will need to:
Resize the filesystem
Resize the LV
Create a new LV
Format the new LV
copy data from the old /var to the new /var
Edit /etc/fstab to add /var LV.

Boot up using the installation disk to the rescue mode.
Sorry, I forgot to mention this is a remote server I am renting, So I can not boot up with the installation disk.

Will I still be able to do this remotely?

Also what exactly is a LV? I think it stands for logical volume, but what exactly is it?
 
Old 11-07-2012, 02:59 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
You can find lots of info on the web about LVM
http://www.howtoforge.com/linux_lvm

You should be able to perform LVM operations and copy the files on a live system. Since /var contains lots of open files/variable data that are changed on a running system so it is safest to boot into a rescue mode. In addition since there are open files that can not be simply moved so at the moment I do not know of an easy method to delete the original files to free up space. Others might have a better idea.
 
Old 11-07-2012, 05:45 PM   #7
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
As per michaelk, I think you'd really want to go through rescue mode for the final re-naming.
I guess you'd do all the setup as specified, inc a new entry in fstab (which won't take effect until you reboot), then ask your Provider to do the final steps for you.
 
Old 11-07-2012, 10:07 PM   #8
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
http://www.reddit.com/r/linux/commen...m_to_a_second/
 
  


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
How can I move my home directory to another hard drive? ratman1 Linux - Newbie 13 02-29-2012 10:59 AM
load Linux onto a hard drive on one computer then move the hard drive to another Ark9 Linux - Newbie 2 10-06-2008 06:56 PM
how can I move my /home directory to a brand new hard drive? toben Linux - Hardware 7 03-04-2008 03:13 PM
2nd hard drive for home directory? morghanphoenix Ubuntu 2 09-20-2006 09:37 PM
2nd hard drive neo.sarcastic Linux - Hardware 4 09-22-2003 11:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:31 AM.

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