LinuxQuestions.org
Review your favorite Linux distribution.
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 08-21-2008, 07:03 AM   #1
Junior_DBA
LQ Newbie
 
Registered: Aug 2008
Posts: 25

Rep: Reputation: 15
adding new drive


Hi all. I added a new drive to my system /dev/shm and i have a folder /oradata with files in it.

I want this folder to be on the new drive and drive i want to be mounted to the /oradata so i did:

mv /oradata /dev/shm and got error permission denied.

What am i doing wrong?

Last edited by Junior_DBA; 08-21-2008 at 07:04 AM.
 
Old 08-21-2008, 07:20 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
If you have added a physical drive, you need to do several things (possible commands in parens---check the man pages for each one):
set up one or more partitions (fdisk, cfdisk, gparted, etc.)
format the partition(s) with a file system (mkfs)
mount the partition(s) to your existing filesystem tree (mount, fstab)

the mv (move) command is used to move files once all the above is done.

I'm puzzled about the designation "/dev/shm"---is that what you get if you run "fdisk -l"?
 
Old 08-21-2008, 07:27 AM   #3
Junior_DBA
LQ Newbie
 
Registered: Aug 2008
Posts: 25

Original Poster
Rep: Reputation: 15
Thanks! We did all what you said and now it works fine.

Yes, /dev/shm i got from fdisk -l i thought that it was my new drive )
 
Old 08-21-2008, 07:32 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
memo to <<insert name of your favorite deity>>:

Please update all human life forms to behave more like Junior_DBA. Actually answering queries and even saying "thank you"---what a novel concept.......
 
Old 08-21-2008, 07:33 AM   #5
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
/dev/shm is a device which is used for shard memory access. If you have added a hard disk to your system, I think you have mis-identified the device for the drive.

Looking at the output of dmesg might be able to provide you with the proper device id for your disk. Typically this will be /dev/hd? or /dev/sd? for consumer disks.

The device is not something which you deal with directly - you should not copy files to /dev/sda for example.

Instead, you should partition the disk, format the partitions, and then mount them at some point in the filesystem. Partitions have devices in /dev/, with a number appended to the base device. For example, /dev/sdb2 is the second (primary type) partition on the drive /dev/sdb.

For example, let's say the new disk is /dev/sdb. The procedure you would be looking at would be something like this:
  1. NOTE: this procedure is not the right one if your system uses LVM - only for "traditional" filesystems.
  2. Backup, and make sure you have a working restore procedure.
  3. Shut down oracle and whatever else might be using files in /oradata/
  4. Use fdisk or cfdisk or gparted or some similar tool to create one or more partitions on the disk. Lets take the simplest option and create one primary partition of type ext3 - that partition will get the device node /dev/sda1
  5. format the new partition with:
    Code:
    mkfs.ext3 /dev/sdb1
  6. temporarily mount the new partition on /mnt. /mnt is used for mounting devices for a short time. As root:
    Code:
    mount /dev/sdb1 /mnt
  7. Copy the files to the new disk, mounted on /mnt.
    Code:
    cp -vdpr /oradata/* /mnt/
  8. Create a file to act as a flag to show you are using the new disk (see later step)
    Code:
    touch /mnt/is_new_disk
  9. un-mount the disk from /mnt:
    Code:
    umount /mnt
  10. Edit the /etc/fstab adding a line so the new disk will be mounted at boot. Add a line like this:
    Code:
    /dev/sdb1 /oradata ext3 errors=remount-ro 0 2
  11. mount the disk, this time in the proper location. Since you have added a line in /etc/fstab, you should be able to do it like this:
    Code:
    mount /oradata
  12. Check that /oradata now contains the data from the disk. Since you made the file "is_new_disk" a few steps ago, you should be able to see that in /oradata now.
After this procedure, you will have two copies of the /oradata files - one on the new disk which is accessible in the /oradata directory. The old copy of the files will still exists on whatever device they used to (I assume it is the root device, else the procedure above will not work properly). These old files will not be visible until you un-mount the new disk. I recommend leaving them there until you have done a careful test of the new setup. Only then should you consider deleting them. The procedure to delete the old files is like this:
  1. un-mount the new disk:
    Code:
    umount /oradata
  2. Verify that you are looking at the old files (the "is_new_disk" file should have disappeared).
  3. Do the deletion. Be totally sure what is going on before doing this command:
    Code:
    rm -rf /oradata/*
  4. re-mount the new disk:
    Code:
    mount /oradata
  5. All your files are OK, right? If not, get that backup out.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Adding new HD drive strankan Linux - Hardware 3 01-07-2006 10:07 AM
Adding a new drive raysr Linux - Hardware 2 12-30-2004 11:28 PM
adding a hard drive Serena Linux - General 2 07-19-2003 06:39 PM
Adding a new drive????? billkris Linux - Hardware 7 01-29-2003 08:22 PM
Adding new drive tkatrib Linux - Software 1 03-05-2001 05:27 PM


All times are GMT -5. The time now is 12:08 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration