LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   connect external hard disk to linux server (https://www.linuxquestions.org/questions/linux-server-73/connect-external-hard-disk-to-linux-server-811761/)

nsk04 06-02-2010 02:03 PM

connect external hard disk to linux server
 
HI,
I have Red Hat linux server with update 8.

Explain me in detail how to connect external hard disk to linux server so that it will detect it. Also let me know how can i come to know whether the linux server has detected it.
Also how to copy the linux server harddisk content/data to this USB External hard disk

AlucardZero 06-02-2010 02:15 PM

1. plug it in
2. boot
3. check if it's automounted with "mount"
4. If not, mount it. It's probably /dev/sdX1 where X is a letter
5. use cp to copy files

It's probably that easy. If you run into problems then come back with details about exactly what you did and what errors you are receiving.

ComputerErik 06-02-2010 09:12 PM

Quote:

Originally Posted by AlucardZero (Post 3990361)
1. plug it in
2. boot
3. check if it's automounted with "mount"
4. If not, mount it. It's probably /dev/sdX1 where X is a letter
5. use cp to copy files

It's probably that easy. If you run into problems then come back with details about exactly what you did and what errors you are receiving.

There is also a pretty good chance it will automount if you just plug the USB drive in with the server up. If not it is easy enough to mount with the mount command.

SaintDanBert 06-02-2010 11:26 PM

If you use cp it will certainly move most of the content.
Is that what you mean to do or are you looking to use the external drive as a "clone" or other detailed backup copy.

Check out rsync and related scripts and GUI aids. In short,
the rsync utility says "Take the folder and file structure from HERE
and make an identical copy over THERE." The advantage comes from the fact that rsync only moves what doesn't already exist or what is different.

You can even use udev rules so that when you connect your external drive, a script runs, uses rsync, and brings your copy up-to-date. Just a thought.

~~~ 0;-Dan

goldeneye075 06-03-2010 04:09 PM

I also have a same type of question:
I need to copy my data from the pc to an external hard drive with keeping the attributes;
so i used the command

cp -rp ~/sourceDir ~/Destination

but when i am coping it it give the error message
"cp: failde to preserve ownership for 'file' : Operation not permitted

and it copied the files to the destination but the attributes has changed from
-rw-r--r-- to
-rwxr-xr-x

I tried to copy it by loging as the root also but still the same thing happens. If possible please let me know how to copy the files with preserving the attributes

Thanks

ComputerErik 06-03-2010 04:12 PM

What is the file system on the destination drive? I don't think you will be able to preserve if it is going from ext3 to FAT for example.

goldeneye075 06-04-2010 08:25 AM

/dev/sdb1 vfat

is it possible to partion the external hard drive to ext3 and to vfat?

SaintDanBert 06-04-2010 07:19 PM

Quote:

Originally Posted by goldeneye075 (Post 3991761)
...
i used the command

cp -rp ~/sourceDir ~/Destination

but when i am coping it it give the error message
"cp: failde to preserve ownership for 'file' : Operation not permitted
...

When making archival copies of files, it is usually best to do this under super-user (root) permissions. No only can root access almost everything without trouble, but it can certainly write-to almost everywhere as well.

Consider the following when trying to make a file copy for long term storage purposes:
Code:

user@host/path $ sudo cp --archive  sourceFiles  targerFolder/
The --archive option expands to include
  • --preserve=links ..... cause links to appear in the target
  • --preserve=mode ..... write original mode (permission) bits
  • --preserve=ownership ..... write original ownership data
  • --preserve=timestamp ..... write original time data
  • --no-dereference ..... copy link as a link not its contents
  • --recursive ..... open folders and process their contents

If you use --verbose, it will likely be slower when you watch it on your terminal STDOUT. Re-direct to a file and browse it later. You can check on progress with tail --lines=NN or tail --follow.

~~~ 0;-Dan

ComputerErik 06-06-2010 02:37 PM

Quote:

Originally Posted by goldeneye075 (Post 3992372)
/dev/sdb1 vfat

is it possible to partion the external hard drive to ext3 and to vfat?

What do you mean ext3 and vfat? As far as the OS is concerned an external drive is just another block storage device, so it can be formatted and partitioned just as any other drive. Typically an external drive will have a single large partition, and a single parttion can only have one file system.

So yes, you can format the drive as ext3, NTFS, ext2, FAT32, etc. However you will need to choose only one FS (keep in mind if you change to ext3 the drive will not be readable in Windows) if you keep the default partition layout. Another option is to partition so that you can split the space between multiple FS types.


All times are GMT -5. The time now is 08:54 AM.