[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Moving selected file systems to new hard disk




I had kept a copy of a really great article posted on another mailing list
for this but now seem to have lost it.  I would like to upgrade and move
things like /home and /usr to a new scsi hard disk drive which has much more
room.  The old disk is /dev/sda and I am installing a new IBM 18 gig scsi
drive to /dev/sdb.  I would definitely like to get /home there since it
seems to grow quite quickly.  If /usr could move also, that would be cool.

--
Michael Perry
mperry@tsoft.com
------------------

I recently did this on my system, and this is the advise I received. Create the
new partitions on /dev/sdb, then mount each partition under /mnt. Go to the
directory you want to move, the example shows /usr, but /home, /var and such
should be the same. I was told there was some issue with sockets not moving
correctly with tar, but I don't know what a socket is, and I was able to move
/usr with no issues. As I am new to Linux as well, I asked for, and got a very
good explanation of what this command did. After I had moved the directories, I
just needed to update /etc/fstab to mount the new partitions under the proper
directories. I'm still waiting to copy and resize my root partition.

> cd /usr
> tar cpf - . | (cd /mnt ; tar xpf -)
>

tar    : you know this
c      : create
p      : preserve permisions (rwx and owners, etc)
f      : file name, the next arg will give the name of the file
-      : most commands understand this to mean stdin/stdout.
         tar is one, so this is stdout.
.      : the current directory.  if you make a tar file of
         . and then do a tar t of it, everything will look like
         ./foo, ./bar, ./zoo/cow, and so on.  an ls -a will show
         both . and .. dirs.

the parenthesis around the other two commands force them into a
subshell, so it's almost like piping into a shell script.  that way the
cd command takes effect, and that's also why the cd doesn't affect your
current session - at the end of this command you'll still be in /usr.



Reply to: