May 26, 2017, 12:24:06 am
News:
Pages: [1] 2 3 4
Print
Author Topic: Migrating link to a HDD  (Read 22644 times)
joachimp
Newbie
*
Posts: 8


View Profile WWW
« on: December 21, 2008, 03:59:52 am »

I received the link Friday evening. This evening I'm running the link image from an internal 3.5'' sata disk plugged into the first sata port. This is how I did it. NB! I'm not sure _yet_ if the bios comes up on HDMI output, if it doesn't, you will need a computer monitor.

There are four main steps once you've installed the drive. First, you need to partition and format your new internal drive.
Second, you need to move the operating system and program files to the new drive. Third, you need to edit /etc/fstab and /boot/grub/menu.1st to make sure they point to your new drive.  Fourth, you need to write the master boot record to the new internal drive

I used cfdisk, mkfs.reiserfs, and mkfs.xfs in the terminal for partitioning and formatting the new drive. If you haven't used these utilities before I suggest checking out  gparted or qtparted, for a more user friendly experience. I like to have a few partitions on my drives to keep from accidentally filling up '/' . For the purpose of this little write up I'm going to assume that you only have one partition. And I'm going to assume that you have plugged the a *SATA* drive into the first port on the motherboard. In that case your drive will have block device location of '/dev/sda' and the first partition '/' will be at '/dev/sda1' I'll even assume that you are using the EXT3 filesystem. Depending on how you partitioned the disk, and how ubuntu is feeling at the time, you might want to reboot the Link now.

If you figured out how to get your drive partitioned. It should show up on the desktop when the link finishes rebooting. If it is there, click on it(or maybe double click), so that the file browser comes up. Now drive should be mounted.  Now find the Terminal, it lives under the Ubuntu icon in the 'Accessories' menu. I'm as long as you your new disk is substantially larger than 4 or so gigabytes that the link system usb drive is, it should be pretty easy to find using the 'df -h' command. It will probably be the last in the list, provided you don't have any other usb drives plugged in. It should look something like '/dev/sda1    950G  45M  950G 0% /media/disk'  You are interested in that last part, /media/disk.[-1,2,..,n] This is where your new drive is mounted.  I'll assume /media/disk

Now be root('sudo su -'), or use sudo for all future comands. Time to copy the system and programs, this takes a little while, so be ready to go eat lunch or something.
Code:
sudo su -
rsync -a --exclude="/dev" --exclude="/proc" --exclude="/sys" --exclude="/media/disk" / /media/disk
mkdir /media/disk/{proc,dev,sys}
Fix device nodes
Code:
cp /dev/MAKEDEV /media/disk/dev/
cd /media/disk/dev/

./MAKEDEV generic-i386

Now you have to make sure that /media/disk/etc/fstab is in order.
Edit it:
Code:
vim  /media/disk/etc/fstab
You want to get rid of the references to BOOT and ROOT which leaves you will an fstab that should look something like this.
Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/sda1       /              ext3 notail          0       1

Now edit 'menu.1st' to point to "/" on the first partition of the first harddrive '# groot=' line, and so that the kernel options '# kopt=' line reads like this:
Code:
vim /media/disk/boot/grub/menu.1st
# groot=(hd0,0)           
# kopt=root=/dev/sda1 ro                                         

Now for some very careful use of dd to copy the MBR to the new drive, WARNING, DON'T MIX UP THIS UP, YOU WILL OVERWRITE YOUR USB MBR:
Code:
dd bs=512 count=1 if=/dev/<use 'mount' to find where in /dev/ your neurosLink USB is mounted> of=/dev/sda
Now here is where things may have gotten a bit redundant, run grub-install with respect to your new drive:
Code:
chroot /media/disk
grub-install /dev/sda
update-grub
After this, I also had to point grub to the new drive on reboot manually at the grub> prompt,
At the grub> prompt NB! These should auto complete with the TAB key. You may have a newer kernel, so don't just copy word for word!
Code:
grub>root (hd0,0)
grub>kernel (hd0,0)/vmlinuz-2.6.27-7-generic ro root=/dev/sda1
grub>initrd (hd0,0)/initrd.img-2.6.27-7-generic
grub>boot

And then run 'update-grub' once you have booted into a working system on the new hardrive

Hope this works for you! Sorry for those that tried this before I had finished, I didn't mean to post early!

 
« Last Edit: December 28, 2008, 02:01:40 am by joachimp » Logged

Joachimp
mpcd
Newbie
*
Posts: 2


View Profile
« Reply #1 on: December 21, 2008, 08:56:39 am »

I used the "Direct Flashing of Image in Linux" method outlined in the support forum, and then used GParted to resize the "ROOT" partition to the full size of the drive. This method allowed me to use the official disk image directly. I like your method because it lets you switch filesystems from the default ext2.
Logged
JoeBorn
Neuros Audio Team
Administrator
Hero Member
*****
Posts: 1376



View Profile WWW
« Reply #2 on: December 22, 2008, 01:13:54 am »

Bless you for these instructions!

Joe
Logged

jborn (at) neurostechnology.com
#neuros on freenode.net
lordvolt
Newbie
*
Posts: 4


View Profile
« Reply #3 on: December 27, 2008, 11:21:49 pm »

I got through all of that ok... but the drive wont boot. Looking back over the instructions, you mention needing to edit grub/menu.1st and writing a master boot record to the hard drive.... I could not find anything in menu.1st that needed editing? and writing master boot record... did some google hunting and came up with

grub-install /dev/sda

but that was unsuccessful (gave an error about BIOS Device Not Found)

any help would be greatly appreciated!
Logged
joachimp
Newbie
*
Posts: 8


View Profile WWW
« Reply #4 on: December 28, 2008, 02:03:29 am »

lordvolt:
Sorry about that, I hadn't  realized that my posting was live, please boot with your Neuros USB drive, and see the last few instructions!
Logged

Joachimp
joachimp
Newbie
*
Posts: 8


View Profile WWW
« Reply #5 on: December 28, 2008, 02:07:48 am »

I used the "Direct Flashing of Image in Linux" method outlined in the support forum, and then used GParted to resize the "ROOT" partition to the full size of the drive. This method allowed me to use the official disk image directly. I like your method because it lets you switch filesystems from the default ext2.

Yeah, I'm not a big fan of how ext3/ext2 perform. I personally use reiserfs for / and /home  and then xfs for media storage partitions. But I didn't want to scare people off with exotic partitions... Wink
Logged

Joachimp
JawsThemeSwimming428
Full Member
***
Posts: 171


View Profile
« Reply #6 on: December 29, 2008, 08:01:43 pm »

You mention something about not being sure whether or not the BIOS comes up on HDMI output...why does this matter? I see no reference to doing anything in BIOS in your instructions. Thanks for the clarification.
Logged
joachimp
Newbie
*
Posts: 8


View Profile WWW
« Reply #7 on: December 29, 2008, 09:31:45 pm »

You mention something about not being sure whether or not the BIOS comes up on HDMI output...why does this matter? I see no reference to doing anything in BIOS in your instructions. Thanks for the clarification.
I had to point the bios to boot from the harddisk also.
Logged

Joachimp
JawsThemeSwimming428
Full Member
***
Posts: 171


View Profile
« Reply #8 on: December 30, 2008, 01:09:29 am »

I posted a little too soon, I should have tried it first. I ran into the same issue!
Logged
JawsThemeSwimming428
Full Member
***
Posts: 171


View Profile
« Reply #9 on: January 03, 2009, 05:09:17 pm »

I'm having a lot of trouble getting this to work. Here are a few issues I am running into:

1. When I initially copy everything over it gives me a Permission Denied error saying it couldn't copy /home/neurostv/.gvfs
2. I'm not sure what I am supposed to do in fstab. I don't think I saw any references to ROOT or BOOT and mine looked completely different. I am booting off the USB stick and have connected an internal 160GB SATA drive to the first SATA port. I know it is there because I was able to partition and format it with GParted from the USB stick. In my fstab I show UUID's and I am not sure where they go. The way I have set up my internal HDD is a 30GB partition for /  and a 130GB partition that will just be used for DATA, not /home. Not sure if that makes a difference. What I did was delete everything in my fstab and keep what you had in the instructions. The two entries, one for proc and one for / on /dev/sda1.
3.  When editing menu.lst I was confused as well. I am not sure I edited at the correct spot the groot and kopt lines.
4. I have no idea about the dd command. When I run it (I copy and paste your code in the instructions above) it gives me a bash: use: No such file or directory.

That's as far as I got, I'm guessing I should just start over but think I would run into the same issues the next time. If someone could help me out or maybe give me some guidance with the instructions that would be great. I would really like to get the Link working from the HDD because the USB is very slow and sometimes unstable. Thanks, I appreciate your help!
Logged
JawsThemeSwimming428
Full Member
***
Posts: 171


View Profile
« Reply #10 on: January 05, 2009, 10:03:34 pm »

Still having some issues with this, no real progress. Not sure what I am doing wrong.
Logged
greyback
Administrator
Hero Member
*****
Posts: 1639


View Profile
« Reply #11 on: January 06, 2009, 09:03:18 am »

1. Are you sure you ran the rsync command under root, or with sudo?
2. The fstab denotes which partitions are mounted where. If ROOT and BOOT aren't there, then no harm. Just change the fstab on the HDD so that /dev/sda1 is /, and the proc entry too.

Note that /dev/sda* labels change depending on what device you are booting from. So while your HDD may be /dev/sdb when booting from your USB drive, it most likely will be /dev/sda when booting from the HDD. This is why UUIDs are handy, each partition has the same unique string, irrespective of the booting OS.

So you should have something like:
Code:
proc            /proc           proc    defaults        0       0
/dev/sda1       /              ext3        notail          0       1
/dev/sda2   /home   ext2  defaults  1       2

3. Compare the file on your USB stick, with the one copied to the HDD. You just need to make sure that grub will boot from the correct partition & pass the kernel the correct options.

4. You need to re-read the line:
Code:
dd bs=512 count=1 if=/dev/<use 'mount' to find where in /dev/ your neurosLink USB is mounted> of=/dev/sda
The important bit is: "use 'mount' to find where in /dev/ your neurosLink USB is mounted". This is saying to type the 'mount' command, and see where / is mounted from. This is the dev node for the USB stick. You want to copy the boot sector from the USB stick to the HDD. The above command does this. So if mount says that / is mounted from /dev/usb1 say (guess), then the command you type is
Code:
dd bs=512 count=1 if=/dev/usb of=/dev/sda
-G
Logged
JawsThemeSwimming428
Full Member
***
Posts: 171


View Profile
« Reply #12 on: January 06, 2009, 12:22:41 pm »

Thanks, I will give this a shot in the next few days and report back. I appreciate the help!
Logged
JawsThemeSwimming428
Full Member
***
Posts: 171


View Profile
« Reply #13 on: February 12, 2009, 01:52:27 pm »

This is the error I am getting when I try to run the first command (rsync):


neurostv@neurostv:~$ df -
df: `-': No such file or directory
df: no file systems processed
neurostv@neurostv:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb2             3.4G  2.6G  678M  80% /
tmpfs                 378M     0  378M   0% /lib/init/rw
varrun                378M  240K  378M   1% /var/run
varlock               378M     0  378M   0% /var/lock
udev                  378M  2.8M  375M   1% /dev
tmpfs                 378M     0  378M   0% /dev/shm
lrm                   378M  2.0M  376M   1% /lib/modules/2.6.27-11-generic/volatile
/dev/sdb1             236M   28M  197M  13% /boot
tmpfs                 192M  800K  192M   1% /tmp
/dev/sda1              32G  177M   30G   1% /media/disk
neurostv@neurostv:~$ sudo rsync -a --exclude="/dev" --exclude="/proc" --exclude="/sys" --exclude="/media/disk" / /media/disk
[sudo] password for neurostv:
rsync: readlink "/home/neurostv/.gvfs" failed: Permission denied

Any ideas?

EDIT: I did a little research and found this http://linux.derkeiler.com/Mailing-Lists/Ubuntu/2008-11/msg00533.html . I tried the second one and got a bunch of other errors. Didn't work.


Still having this issue. Not sure how to proceed. Google searching has not returned anything I was able to get to work. Any instructions would be appreciated.
« Last Edit: February 15, 2009, 09:24:01 pm by JawsThemeSwimming428 » Logged
cyrus
Jr. Member
**
Posts: 74


View Profile
« Reply #14 on: February 15, 2009, 11:36:22 pm »

I will post my instructions - which basically took the official image and dd copied it to the new drive.

Install the new drive (I assume you know how to do this and will not go into details). Upon boot, enter the BIOS and go to Boot -> Hard Disk Drives and make sure the 1st Drive is set to Crucial Gizmo! (or whatever your flash drive is called). Boot up the system.

Open terminal and run the following:
 
                  sudo dd if=/dev/sdb of=/dev/sda bs=1M

Once that completes reboot the system.

The next step is to resize the sda2 partition. Open a terminal and sudo or su to root.  Here are the steps I ran:
               
               sudo e2fsck -f -y -v /dev/sda2
               sudo gparted
               
Right click the /dev/sda2 partition and select unmount. Right click again and resize and set the size that you want for the partition. Then apply your changes. Hopefully that will succeed. If it fails,  expand the details window until you can find out where it encountered a problem. You may have to end up running a specialized e2fsck to correct any other filesystem errors.

** for the following steps I opened a terminal and su to root **

Since I wanted to keep the flash drive as is and plugged in, I needed to reset the UUID for the new partitions. To do this I ran the following commands:

          tune2fs -U `uuidgen` /dev/sda1
          tune2fs -U `uuidgen` /dev/sda2

Reboot the system.

The next steps is to update the /etc/fstab file as well as the /boot/grub/menu.lst file. Before doing this you need to acquire the new UUIDs for the sda1 and sda2 partitions. To do this run the following:

           blkid

Now mount the /dev/sda2 partition

          mount /dev/sda2 /mnt/MOUNT_POINT

Edit the fstab file

         vi /mnt/MOUNT_POINT/etc/fstab

Update the new UUID for the / and /boot partitions (/dev/sda2 and /dev/sda1 respectively). Save the file and exit.

Edit the menu.lst file:

         mount /dev/sda1 /mnt/MOUNT_POINT/boot
         vi /mnt/MOUNT_POINT/boot/grub/menu.lst

Look for each kernel definition and update the root=UUID= statement to the new UUID for the root partition (/dev/sda2).
Look for the uuid definition and update to the new UUID for the boot partition (/dev/sda1)

The last step prior to rebooting is to resize the filesystem. First make sure that the /dev/sda2 partition is not mounted, then run:

         resize2fs /dev/sda2

Reboot the system and enter into BIOS and go to Boot -> Hard Disk Drives and make sure the 1st Drive is set to your internal HDD.

After that you should be okay.
« Last Edit: February 15, 2009, 11:43:27 pm by cyrus » Logged
Pages: [1] 2 3 4
Print
Jump to: