LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 10-10-2005, 11:48 AM   #1
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Rep: Reputation: 30
move folder to new partition


Hey all,
I have a folder full of pictures. I am looking to attach an external hard drive via USB2.
The pictures are located in /home/special and im looking to leave this folder in this directory tree, but move its location to the external partition.

I would image in need to mount the new hard drive on /home/special??
and then edit /etc/fstab to auto mount the external hd at each boot.

Can someone help me to outline how i can accomplish this without loosing data? Thank you very much


Josh
 
Old 10-10-2005, 12:04 PM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,936
Blog Entries: 5

Rep: Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751
1) Rename existing folder:
mv /home/special /home/special.old (assuming existing /home/special is not a mount itself but rather a home directory of /home - if its a mount you need to umount it then do the rename.)

2) Do mkdir /home/special to recreate an empty directory to use as mount point.

3) Do your fdisk/newfs stuff on the external to make it a filesystem.

4) Rather than mounting the filesystem then adding it to /etc/fstab I'd suggest you add it to fstab first then just type "mount /home/special". The benefit here being that the mount command would then get all its options from what you'd put in /etc/fstab and thereby verify it was correct. (You don't want to find out on boot that its wrong.)

5) Type df -k /home/special to verify it is mounted as you expect rather than just being a subdirectoy of another mount.

6) Copy all the files from /home/special.old to the newly mounted /home/special
cp -pR /home/special.old/* /home/special (don't foreget to check afterwards for .* files in /home/special.old to make sure you didn't leave any hidden files there.)

7) Wait a week or so before blowing away the /home/special.old to make sure you didn't miss anything. When ready to blow it away:
rm -rf /home/special.old
 
Old 10-10-2005, 12:10 PM   #3
Tuttle
Senior Member
 
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,289

Rep: Reputation: 52
Try putting this in your /etc/fstab:
Code:
/dev/usb_device_name       /home/special            auto    defaults         0   0
To find out the "usb_device_name", plug in your usb drive and (if it automatically mounts) you can type "mount" into a terminal to see a list of all mounted partitions, their mountpoints (like /home/special will be) and their /dev name. Also _if_ your usb drive automounts at the moment, you should see a temporary entry for it in /etc/fstab to give you a hint.

edit: double-post!

Last edited by Tuttle; 10-10-2005 at 12:12 PM.
 
Old 10-10-2005, 12:13 PM   #4
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Original Poster
Rep: Reputation: 30
Wow,
thanks great, thanks so much, im going to try this.

I already have however data on my external hard drive, and i believe it is already in NTFS
format, This may be an issue huh??
I have already been able to mount my winxp partition (ntfs) with no problem, so i should
be ok.

What is the best way to find out which hda the external is? other than just knowing what is
there now, and seeing it when i attached it? If there is one at all.

Thanks so much
 
Old 10-10-2005, 12:14 PM   #5
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Original Poster
Rep: Reputation: 30
Ha, ok, thats great tuttle, too quick for me. thanks
 
Old 10-11-2005, 03:49 PM   #6
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Original Poster
Rep: Reputation: 30
Hey,
Ive just realized that I should resize my external hard drive, as to not disturb my data currently on it.
out put of fdisk -l /dev/sda
Code:
Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       30401   244196001    7  HPFS/NTFS
i would like to use, lets say 70G for a new NTFS partition.

I have never created a new partition on a live drive, and would jus tlike anyone else prefer not to loose my other data on it already.
Can someone lead me in the right direction?

THanks
 
Old 10-11-2005, 06:00 PM   #7
Tuttle
Senior Member
 
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,289

Rep: Reputation: 52
You will need to use partition magic or something to resize a NTFS partition (or copy it to a temporary location while making new partitions).
Re-size (using partition magic) then make a new active partition (using fdisk) and create an ext3 (for example) filesystem on it like this:
Code:
mke2fs -c -j -v /dev/sda2
where /dev/sda2 is the second partition on sda and /dev/sda1 is the resized NTFS (first) partition. Double, nay triple check the /dev name before you try anything

also, see "man mke2fs" and for more options.

Last edited by Tuttle; 10-11-2005 at 06:03 PM.
 
Old 10-11-2005, 06:24 PM   #8
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Original Poster
Rep: Reputation: 30
Is there a way that i can just resize via linux without partition magic?? and then create the new partition.

The reason for this is This server and HD are offsite from me. I would like to do all this and just leave the data in /dev/sda1 and create /dev/sda2.

Is this possible?
 
Old 10-12-2005, 11:30 AM   #9
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Original Poster
Rep: Reputation: 30
So, after i resized my NTFS partition, and was still viewable, so i believe it resized correctly.
When i use fdisk, to create the second partition, is this an extended or primary? I believe extended, so i did so.

results of fdisk table print:
Code:
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       18254   146625223+   7  HPFS/NTFS
/dev/sda2           18255       30401    97570777+   5  Extended
i then went to use mke2fs to create the ext3 filesystem, and ran into an error:
Code:
mke2fs 1.37 (21-Mar-2005)
/dev/sda2: Invalid argument passed to ext2 library while setting up superblock
Did i do something wrong here??
 
Old 10-12-2005, 12:23 PM   #10
Tuttle
Senior Member
 
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,289

Rep: Reputation: 52
Quote:
Originally posted by blizunt7
So, after i resized my NTFS partition, and was still viewable, so i believe it resized correctly.
When i use fdisk, to create the second partition, is this an extended or primary? I believe extended, so i did so.

results of fdisk table print:
Code:
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       18254   146625223+   7  HPFS/NTFS
/dev/sda2           18255       30401    97570777+   5  Extended
i then went to use mke2fs to create the ext3 filesystem, and ran into an error:
Code:
mke2fs 1.37 (21-Mar-2005)
/dev/sda2: Invalid argument passed to ext2 library while setting up superblock
Did i do something wrong here??
Primary would have been the one you wanted, an extended partition is a placeholder in which to put more partitions. Just do fdisk again, delete what you created and redo it with a primary partition.
Standard dos style layouts forbid more than 4 primary partitions, that is why the "extended" partition was made, for when you need more than 4 slices.
Everything else is good, n1.

edit: a little more info: the extended partition can occupy one of the first four primary slots ie. sda1,2,3 or 4
All the partitions within the extended partition become sda5,6,7... onwards.

Last edited by Tuttle; 10-12-2005 at 12:30 PM.
 
Old 10-12-2005, 12:35 PM   #11
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Original Poster
Rep: Reputation: 30
WOW, worked like a champion. THanks.
WHen i created it, fdisk automatically created it as a linux filesystem (type 83).

Is this ext3??? i went to mount it as ext3, and did not work, said wrong fstype, bad option, bad superblock on /dev/sda2.

Should i specify the filesystem type ? becuse it wouldnt let me.

THanks again
 
Old 10-13-2005, 07:16 AM   #12
Tuttle
Senior Member
 
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,289

Rep: Reputation: 52
Probably ext2, ext3 is a jounalised version of ext2, a little more robust during a system lockup. Just use the "auto" option in your fstab, then type "mount" to see what type it chose.

Or you could just try "mke2fs", experiment

Last edited by Tuttle; 10-13-2005 at 07:17 AM.
 
  


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
how to tell bash to move files to another folder? hq4ever Linux - Newbie 10 12-30-2010 03:15 AM
Move Choices-Folder from rox to different location Fonk Linux - Software 1 04-16-2005 08:50 PM
making a script that will move a file or files in a trash folder Paxmaster Programming 5 12-12-2004 06:00 PM
Cant move a folder to another path? dwarf007 Linux - Newbie 2 09-19-2004 02:28 AM
Partition Free Space - Move /home to the new partition gregkise Linux - General 5 12-16-2003 10:19 PM


All times are GMT -5. The time now is 11:37 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration