Click to See Complete Forum and Search --> : tarred and want it back


Dirk
11-24-2001, 02:04 AM
I ran ]tar cvf /home/user /dev/hdb1 to put it on my 2nd hdd. How do I now get it back to my /home/user hda6? Thanks

X_console
11-24-2001, 02:07 AM
I don't understand your question. Please elaborate. You tarred up your /home directory and moved it somewhere? If you want it back, just move it back and then untar it.

Dirk
11-24-2001, 09:28 AM
Sorry. I tarred the /home/user to a 2nd hard disk [ hdb ] on my box as I was trying to install a new distro. Now I want to mv that /home/user back to my main hard drive [ hda ] , and my result was as follows;

root]# mv /dev/hda6 /home/user /dev/hdb1
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.

Do I need to mount hdb1 first and if so ,then what?

root]# mount /dev/hdb1
mount: can't find /dev/hdb1 in /etc/fstab or /etc/mtab

[ 24 November 2001: Message edited by: Dirk ]

AdaHacker
11-24-2001, 10:05 AM
Well, to begin with, you don't want to be moving files to or from /dev/hd??. Those are the raw device files, and you really don't want to be writing directly to them. That's the whole point of filesystems.

Now, I'm not sure I know what you did, but I'll take a stab at it. First, type 'mount' at the command prompt and see if there's an entry for /dev/hdb1. If not, you'll have to mount it manually. You can do that with the following command:
mount -t ext2 /dev/hdb1 /mnt
This will mount your second hard drive on the /mnt directory. (If hdb1 isn't formatted as an ext2 filesystem, you'll have to change the -t option.) Now do an 'ls /mnt' and look for your tar file (or directory).If you see it, you can just do a 'mv /mnt/whatever.tar /home'
where /home is wherever you want the tarball. When you're done, if you want to unmount the second hard drive, type 'umount /mnt'.

If you want the second hard drive to be mounted automatically in the future, you'll have to add a line for it in /etc/fstab. For more information try 'man fstab'.

knute
11-24-2001, 10:10 AM
Ummm Dirk, I think I got some bad news for you.

In perusing the manpage for tar, it appears that the way that you issued the command told tar to put the contents of /dev/hdb1 into a tar file named /home/user.

According to the manpage on tar, when you use the f option, the next argument is the filename of the tar file or the device that you will be using for backup.

I have my system set up so that the /home directory is on it's own partition, then when I decide to change something, I can w/o loosing those contents.

X_console
11-24-2001, 11:48 AM
Originally posted by Dirk:
<STRONG>Sorry. I tarred the /home/user to a 2nd hard disk [ hdb ] on my box as I was trying to install a new distro. Now I want to mv that /home/user back to my main hard drive [ hda ] , and my result was as follows;

root]# mv /dev/hda6 /home/user /dev/hdb1
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.

Do I need to mount hdb1 first and if so ,then what?

root]# mount /dev/hdb1
mount: can't find /dev/hdb1 in /etc/fstab or /etc/mtab

[ 24 November 2001: Message edited by: Dirk ]</STRONG>

Yes, you need to mount hdb1 first. The problem you're having is that you're not specifying the directory to mount it in. Specify the directory, and then copy the tarred file into that directory. You don't copy the tar file into /dev/hdb1, but into a directory mounted on /dev/hdb1

Dirk
11-24-2001, 08:27 PM
Ok. So what is the command I use to mount the /home/user on /dev/hdb1 so I can copy said file onto /dev/hda6 where my /home user resides? My current results are;

root]# mount -t ext2 /dev/hdb1 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/hdb1,
or too many mounted file systems

[ 24 November 2001: Message edited by: Dirk ]

bdg1983
11-25-2001, 09:51 AM
Use mount by itself to see if /dev/hdb1 is already mounted.

mount

Dirk
11-25-2001, 02:17 PM
Here is the readout;

root]# mount
/dev/hda1 on / type ext2 (rw)
none on /proc type proc (rw)
devfs on /dev type devfs (rw)
none on /dev/pts type devpts (rw,mode=0620)
none on /dev/shm type tmpfs (rw)
/dev/hda6 on /home type ext2 (rw)
/proc/bus/usb on /proc/bus/usb type usbdevfs (rw,devmode=0664,devgid=43)
automount(pid1259) on /net type autofs (rw,fd=8,pgrp=1259,minproto=2,maxproto=4)automount (pid1236) on /misc type autofs (rw,fd=8,pgrp=1236,minproto=2,maxproto=4)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)


Don't see no /dev/hdb nowheres anywhoo.

[ 25 November 2001: Message edited by: Dirk ]