I am installing a new hard drive to replace my old one that contained the /var and /home directories. I don’t want to copy the whole directories, especially from home because there is a lot I don’t need in it. What I need to do is set the mount points for the two partitions I have made on the new drive to /var and /home, but it will not let me do this with the other drive still running. I can’t unmount /var and /home while the computer is running, and I would guess that having two drives with /var and /home on them would not work.
So, how can I set the mount points on the new drive and copy the files I need from the old to the new one? It would seem that would require two /home partitions to be mounted at the same time, but I don’t think that is possible. I am sure there is some way, probably many ways knowing Linux so please, any of you gurus out there come enlighten me…
Your mount points are set in /ect/fstab which you can use KWRITE to edit using root permissions:
Run Command: kdesu kewite /ect/fstab
You would substitute the new drive uid’s for your old ones and reboot. However, I would connect up the new drive, add it to your fstab and copy your files to it before making it your /home folder. While you may be able to remove some stuff before you do a backup, you are not going to login without the proper user stuff being present.
I found an article about doing a backup and restore you might want to read. You would want a live CD or the gparted CD you can boot from and fix any issues that you create when you make the change.
Easy Backup and Restore - Linux
Make no changes to your old drive, so you could reinstall it, until you have your new one working.
Thank You,
On 04/25/2010 03:46 PM, hito kiri wrote:
>
> I am installing a new hard drive to replace my old one that contained
> the /var and /home directories. I don’t want to copy the whole
> directories, especially from home because there is a lot I don’t need in
> it. What I need to do is set the mount points for the two partitions I
> have made on the new drive to /var and /home, but it will not let me do
> this with the other drive still running. I can’t unmount /var and /home
> while the computer is running, and I would guess that having two drives
> with /var and /home on them would not work.
>
> So, how can I set the mount points on the new drive and copy the files
> I need from the old to the new one? It would seem that would require
> two /home partitions to be mounted at the same time, but I don’t think
> that is possible. I am sure there is some way, probably many ways
> knowing Linux so please, any of you gurus out there come enlighten me…
Create two new directories named /newvar and /newhome, then mount the
new partitions on those directories. Next copy the files you want from
/var to /newvar and /home to /newhome. Finally, edit /etc/fstab so that
the /var and /home entries point to the new partitions instead of the
old, and reboot.
A
O.k. I have copied my files over, and I tried putting the partitions in fstab, but every time I reboot after adding them, it goes to the loading screen and almost all the way through drops to a command prompt. Here is the changes I made to fstab:
Before:
/dev/disk/by-id/scsi-SIBM-ESXSMAP3367NP_FUPV9P3700DLJ-part1 swap swap defaults 0 0
/dev/disk/by-id/scsi-SIBM-ESXSMAP3367NP_FUPV9P3700DLJ-part3 / ext3 acl,user_xattr 1 1
/dev/disk/by-id/scsi-SIBM-ESXSMAP3367NP_FUPV9P3700DLJ-part2 /boot ext3 acl,user_xattr 1 2
/dev/disk/by-id/ata-Hitachi_HDT721075SLA360_STF401MG096VEA-part2 /home ext3 acl,user_xattr,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 1 2
/dev/disk/by-id/ata-Hitachi_HDT721075SLA360_STF401MG096VEA-part1 /var ext3 acl,user_xattr 1 2
/sys/bus/usb/drivers /proc/bus/usb usbfs devgid=1000,devmode=664 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
After:
/dev/disk/by-id/scsi-SIBM-ESXSMAP3367NP_FUPV9P3700DLJ-part1 swap swap defaults 0 0
/dev/disk/by-id/scsi-SIBM-ESXSMAP3367NP_FUPV9P3700DLJ-part3 / ext3 acl,user_xattr 1 1
/dev/disk/by-id/scsi-SIBM-ESXSMAP3367NP_FUPV9P3700DLJ-part2 /boot ext3 acl,user_xattr 1 2
/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV92692731-part2 /home ext3 acl,user_xattr 1 2
/dev/disk/by-id/ata-WDC_WD5000AADS-00S9B0_WD-WCAV92692731-part1 /var ext3 acl,user_xattr 1 2
/sys/bus/usb/drivers /proc/bus/usb usbfs devgid=1000,devmode=664 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
I don’t understand why it doesn’t work, by everything I can read about fstab, that is how it should read.
So a couple of other questions: Is it not possible to boot the OS and even if the home partition is not mounted properly, still log in as root through the gui? Roots home is not on the home partition, so I don’t know why it doesn’t still boot to the loading screen.
There is another device id for each partition that starts with scsi-sata instead of ata. My scsi drive starts with that, but my old sata drive says ata. Does this matter?
So, question number one is, can you change to the home directory and see any part of your new drive? Same for /var. Does the new drive mount or not? If it does not mount, then there is something wrong with the name, if it does mount, then there is something wrong with the data on the new drives. Is it possible to have both drives online at the same time? If so, you could mount the new drive to a different folder, like /mnt, have the partitioner add it for you to fstab, then you would have the exact name fstab is looking for and by that I mean the exact UID to use in fstab. Here is a copy of my four hard drives for reference.
/dev/disk/by-id/usb-Maxtor_3200_2CAH3EY1-0:0-part1 swap swap defaults 0 0
/dev/disk/by-id/usb-Maxtor_3200_2CAH3EY1-0:0-part2 / ext4 acl,user_xattr 1 1
/dev/disk/by-id/usb-Maxtor_3200_2CAH3EY1-0:0-part3 /home ext4 acl,user_xattr 1 2
/dev/disk/by-id/ata-MAXTOR_STM3320620AS_6QF1JFQM-part1 /Windows/HDC ntfs-3g defaults 0 0
/dev/disk/by-id/ata-ST3300831AS_3NF164YY-part1 /Windows/HDD ntfs-3g defaults 0 0
/dev/disk/by-id/usb-ST315005_41AS_0123456789ABCDEF-0:0-part1 /Software ntfs-3g defaults 0 0
The uid is modified by the interface used which you can see as scsi, ata and my usb, so it does need to be the same interface, but not the same exact port. For instance, no matter what usb port I put my drive into, it will say usb. If I had four sata ports, it would say the same for all. My sata ports all say ata. I am not sure but scsi may be pata. By the way, you can add spaces to line up options, but NEVER insert a TAB, as it does not compute and hard to find in the text.
Thank You,
Well, I try using the partitioner in yast, but it will not let me set the mount points as home and var because it says they are in use (and they are). I did put the exact device id that the partitioner gave though.
I am also having an issue with for some reason one of the directories in var is showing up as being 256 terabytes… My drive isn’t even 1 terabyte.
I would suggest a live CD for this ,Parted Magic Downloads
and work from an OS that does not need to be using any version of /var or /home that you are working on.
O.K., I am continuosly running into an issue trying to copy everything from var. When I start out, var says it is 3.1 GB. I use cp -a to copy var to the new partition, but half way through it starts saying no space on disk. The partition is 6 GB, and when I go to check the size of var again, it says it is 256 TERABYTES! What is going on here?!
You are copying something that is constantly changing. In fact since there a cache in the directory and the copy functions would use cache you are entering an infinite loop that only stops when a natural limit is reached.
So use a boot CD to do the operation!!!
I don’t understand why using a boot CD would make a difference in this situation, wouldn’t it just do the same exact operation therefore encountering the same problem? What about using dd? Would that make a difference you think?
There is a difference in backing up a live Linux system and backing up a Linux system that is not running from a Live CD that is running from RAM memory only. The /var folder you are trying to backup is not in use when you do the backup while running Linux from a live CD. Files that are open and files that are used in the backup process can not be backed up. As gogalthorp indicated, you can get into an endless loop trying to backup the /var folder, in which the backup program is putting data into during the backup process.
Thank You,