Results 1 to 3 of 3
I will ask this question again since I really would like to know the answer.
I used the 'mv' (move) command.
But, the 'cp' (copy) is just as applicable and ...
- 01-26-2009 #1Banned
- Join Date
- Jan 2008
- Posts
- 79
Moving and copying files
I will ask this question again since I really would like to know the answer.
I used the 'mv' (move) command.
But, the 'cp' (copy) is just as applicable and probably more so.
The task is most necessary for copying to a different drive's partition. I need to get a new hard drive since I like to have my data separate from my OS I'm using. But, for now, I use a portion that is left free on my other drive.
The past couple of times I have tried, I seemed to 'lose' the file. I mean the copy or move failed and I couldn't find the file again. I try to use copy for this reason. So, at least, I can try again.
I know you have to be root for this so in Fedora/Ubuntu/Debian, how do you do this?
I also don't have my drives/partitions automatically mounted. Is it a good idea to do this? Should I edit /etc/fstab and edit via the drive labels in case I ever shuffle the drives around, or replace or add a drive?
Say, I download a file, "newfile.rar' and I want to copy it to a different drive in another partition, how do you suggest I do this?
To simplify things:
sda1 -> NTFS format -> 20GB
sda2 -> Linux ext3 -> 20GB
sdb1 -> NTFS -> 100GB
sdb2 -> Linux ext3 -> 400GB
These aren't my drive partition setups but just for example. Say, sda1 has a Windows OS and sda2 has a Linux OS. I downloaded a file onto the Linux Os in some directory, let's call it in home and downloads, /home/downloads (or whatever makes sense or is a sufficient example).
But, I wanted it on the other drive so in 'sdb2' which is just a ext3 partition to hold data. The other partition on that drive is a NTFS partition to hold data files for Windows.
Anyway, I want to copy the file, 'newfile.rar' from 'sda2' to the other drive in partition, 'sdb2' so how do you do this? sdb2 is not automounted so most likely, the distro's OS is not detecting or displaying that drive or at least, that partition. If it is not showing, how would I do it?
I suspect, I need to mount it manually so I need a directory to temporarily mount it to so it becomes the mount point. Then I copy the file to that directory and it will end up on the other drive in that partition, sdb2?
Anyway, please steer me in the right direction. Am I on the right track? Close? Far away? Do I have any of that right?
- 01-26-2009 #2
So the core issue here comes to mounting your drives. I also don't use automount, for better or worse. Let me show you my fstab:
So what do we see here?Code:/dev/hda1 /boot ext3 noatime 1 2 /dev/hdb2 / reiserfs notail 0 1 /dev/hdb1 none swap sw 0 0 /dev/hda3 /usr/local/storage ext3 rw,users 1 2 /dev/hda5 /mnt/ubuntu auto noauto,users 0 0 /dev/cdrom /mnt/cdrom iso9660 noauto,ro,users 0 0 /dev/cdrw /mnt/cdrw iso9660 noauto,ro,users 0 0 /dev/fd0 /mnt/floppy auto noauto 0 0 /dev/sda1 /mnt/mybook vfat defaults,users,rw,umask=0000 0 2 /dev/sdb1 /mnt/usb auto noauto,users,rw 0 0 /dev/sdb2 /mnt/ipod vfat noauto,users,rw 0 0
Well, /boot, /, /usr/local/storage, and /mnt/mybook are all automatically mounted when I boot the system. This means that they are always there, with the options I've given.
/mnt/usb and /mnt/ipod, on the other hand, I have to manually mount when I insert them.
So if we suppose that your sdb2 is always mounted at /mnt/storage (or something like that), your cp command would be:
It's that simple.Code:cp /home/user/downloads/newfile.rar /mnt/storage
There are lots of guides to fstab and mounting already out there. I suggest setting up your mounts, and then seeing what happens. Once you have a more specific problem, it will be easier to diagnose what the error is.DISTRO=Arch
Registered Linux User #388732
- 01-27-2009 #3
If something isn't automatically mounted, you can also mount it manually.
You do that as root.
The command is as following (it's only a template).
So for my external hdd it will look like this:Code:mount -t [file system type e.g. VFAT or EXT3] /dev/[device name e.g. sda1] [mountpoint e.g. /media/sda]
That's how simple it all is. You need to make the directory you are going to mount in first. If you don't the file system won't be mounted.Code:mount -t ext3 /dev/sdb1 /media/disk


Reply With Quote