Replace harddisk for larger one

Ethernet disk mini v2
Post Reply
veldscholte
Posts: 6
Joined: Sat Nov 14, 2009 6:22 pm

Replace harddisk for larger one

Post by veldscholte » Sat Nov 14, 2009 7:42 pm

I tried to find information in this community about replacing a harddisk in the EDmini v2. The info most beneficial was the information by mmarcin2 posted Thu Jun 04, 2009. However there was a lot of info that is byond my knowledge and scope(?).
I only want to replace my HDD for a larger one. To be able to I think I have to format the new disk in XSF format. How do I proceed with this? Can I copy the content of all the 6 partitions to the new disk from the network drive to the temporary local drive (target drive)? Do the drives have to be in the same computer? I only have 1 spare slot for my SATA drives, so I cannot connect them both at the same time.

Please can someone help.

Thanks,

veldscholte

Mijzelf
Posts: 6199
Joined: Mon Jun 16, 2008 10:45 am

Re: Replace harddisk for larger one

Post by Mijzelf » Sat Nov 14, 2009 8:45 pm

I think the easiest way to put in a larger disk is to connect both disks to a Linux PC (a Windows PC booted from a Linux Live CD is fine), use dd to clone olddisk to newdisk

Code: Select all

dd if=/dev/olddisk of=/dev/newdisk
and then use gparted to grow the datapartition of newdisk.

You don't need to connect both disks to a SATA port, one connected to an USB enclosure is allright.

Advanced: If you've got enough spare room to copy the whole disk to a file, you only need to connect one disk at a time.

Code: Select all

dd if=/dev/olddisk of=hugefile
# swap disks
dd if=hugefile of=/dev/newdisk
gparted
More advanced: When you don't need to copy the contents of the datapartition, you can do a partly copy, only containing the partition table and the system partitions, and repair it with gparted.

Code: Select all

dd if=/dev/olddisk of=smallerfile bs=1024 count=1200000 # 1.2 gigabytes should be enough
# swap disks
dd if=smallerfile of=/dev/newdisk
gparted

veldscholte
Posts: 6
Joined: Sat Nov 14, 2009 6:22 pm

Re: Replace harddisk for larger one

Post by veldscholte » Thu Nov 19, 2009 7:39 pm

Thank you for your quick reply. I finally found some time to try your suggestion. I'm not very acquainted with Linux, I do have a Ubuntu live disk 7.10 though. Today I tried your suggestion after placing the old disk and new disk in the two SATA slots.

I guessed I had to start the terminal to write your suggested line. As name for the disks I tried
1 the name of the disk, 2 the drives' serial number and 3 the UUID. None of the options seemed to work: I received the message "No such file or directory".
What name should I Use? Do I have to do something else before starting (e.g. mount the disks)?

Thank you for your help.

Mijzelf
Posts: 6199
Joined: Mon Jun 16, 2008 10:45 am

Re: Replace harddisk for larger one

Post by Mijzelf » Thu Nov 19, 2009 8:34 pm

Some more background: When connected to a SATA connector, in Linux drives are called /dev/sdx, where x is a letter a,b,c,... First drive is a, second b, ...
Your two drives are probably called /dev/sdb and /dev/sdc, assuming the 'default disk' is /dev/sda.
you can find the drivenames by typing (yes indeed, in a terminal)

Code: Select all

sudo fdisk -l
This will list the drives, with their partition tables. The old LaCie disk has about 5 partitions, the 2nd being the biggest. The new drive will be empty, I suppose. The remaining drive(s) will be the system drive of your computer. The sudo (superuser do) command is necessary because a standard user doesn't have the rights to execute fdisk.
When you have located the drives, you can do the copying:

Code: Select all

sudo dd if=/dev/sdb of=/dev/sdc
Doublecheck that if (inputfile) and of (outputfile) are the right drives! The data on of will be lost forever.

This operation will take several hours (250GB in about 50MB/sec), and there is no feedback until it's finished. (Besides the disk sounds)
After this is done, the Lacie should be able to boot from the new disk.

veldscholte
Posts: 6
Joined: Sat Nov 14, 2009 6:22 pm

Re: Replace harddisk for larger one

Post by veldscholte » Thu Nov 19, 2009 9:03 pm

Thank you,

I only have two disks installed, see below. So I guess I can type: sudo dd if=/dev/sda of=/dev/sdb?


Disk identifier: 0x398be17d

Device Boot Start End Blocks Id System
/dev/sda1 1 125 1004031 5 Extended
/dev/sda2 126 30401 243191970 83 Linux
/dev/sda5 1 16 128457 82 Linux swap / Solaris
/dev/sda6 17 17 8001 83 Linux
/dev/sda7 18 18 8001 83 Linux
/dev/sda8 19 34 128488+ 83 Linux
/dev/sda9 35 125 730926 83 Linux

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0700bf2f

Device Boot Start End Blocks Id System
/dev/sdb1 2 60801 488376000 f W95 Ext'd (LBA)
/dev/sdb5 2 60801 488375968+ 7 HPFS/NTFS

Disk /dev/sdf: 2028 MB, 2028994560 bytes
55 heads, 54 sectors/track, 1334 cylinders
Units = cylinders of 2970 * 512 = 1520640 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdf1 1 1335 1981314+ 6 FAT16

Mijzelf
Posts: 6199
Joined: Mon Jun 16, 2008 10:45 am

Re: Replace harddisk for larger one

Post by Mijzelf » Fri Nov 20, 2009 9:33 am

/dev/sda is your original LaCie disk. /dev/sdb is a 500 GB disk, but it's not empty. It contains 1 big NTFS partition. That is no problem for dd, by the way, dd doesn't care.
And you've got a 2GB /dev/sdf, which possibly is the USB stick you've booted from?

So yes, sudo dd if=/dev/sda of=/dev/sdb is fine.

veldscholte
Posts: 6
Joined: Sat Nov 14, 2009 6:22 pm

Re: Replace harddisk for larger one

Post by veldscholte » Sat Nov 21, 2009 9:53 am

Yes it works!

Now tried gparted and stumbled upon the next hurdle: I'm not able to grow the XSF partition. See screenshot "gparted no resize.png".

There is unallocated space available, but it seems that the problem is in the XFS partition itself because the resizing arrows are grayed out. Should I change something for the XSF partition?

Also, the terminal gives me the following message:
_________________________________
ubuntu@ubuntu:~$ sudo gparted
======================
libparted : 1.7.1
======================
Unable to open /dev/scd0 read-write (Read-only file system). /dev/scd0 has been opened read-only.
Unable to open /dev/scd0 - unrecognised disk label.
_____________________________________

Is this worrying?
By the way, the 2 gig partition is an SD card. Linux is on a CD.
Is scd0 the live CD (read only)?
You do not have the required permissions to view the files attached to this post.

Mijzelf
Posts: 6199
Joined: Mon Jun 16, 2008 10:45 am

Re: Replace harddisk for larger one

Post by Mijzelf » Sat Nov 21, 2009 10:45 am

Is this worrying?
Is scd0 the live CD (read only)?
No and probably.

According to the featurelist of Gparted it should support growing of an XFS partition, *if* xfsprogs is installed, and the kernel supports the filesystem.
You can try to install xfsprogs, but you are using a rather old Linux system (7.10, current is 9.10), so I don't know if it's still supported:

Code: Select all

sudo apt-get install xfsprogs
Of course you'll have to repeat this each time you reboot the computer, since it's installed in RAM.
If that doesn't work I think your best bet is to download the Gparted LiveCD or USB-stick. Then you've got kernelsupport and xfsprogs, and the latest Gparted.

veldscholte
Posts: 6
Joined: Sat Nov 14, 2009 6:22 pm

Re: Replace harddisk for larger one

Post by veldscholte » Sun Nov 22, 2009 7:39 pm

Mission completed!
I used the Gparted live CD as suggested.

Lost most of the data though. Fortunately I had a backup of the data, so everything is fine now.
Now that I know that the system is so vulnerable to diskcrashes I think it's wise to make a partition backup of the NAS disk to a file (excluding all the data) so that in case of a diskcrash I can still create a new NAS disk.
If understood you correctly I can use:
dd if=/dev/olddisk of=myfilename bs=1024 count 1200000

I will save the file on my backupdisk

Mijzelf
Posts: 6199
Joined: Mon Jun 16, 2008 10:45 am

Re: Replace harddisk for larger one

Post by Mijzelf » Sun Nov 22, 2009 8:58 pm

Congratulations!
Lost most of the data though.
Can you give more info? Did the resizing of the XFS partition kill your data?
Fortunately I had a backup of the data, so everything is fine now.
And of course you still have the old disk.
If understood you correctly I can use:<snip>
Yes. When you´ve booted from your Ubuntudisk, and have your Windows systemdrive in the PC I *think* you can rightclick an icon on the desktop, and mount the Windowspartition read-write. After that, I *think* the partition is mounted at /mnt/Windows_C, which make the the command
dd if=/dev/olddisk of=/mnt/Windows_C/myfilename bs=1024 count=1200000
The name is case-sensitive. The outputfile should be about 1.2GB.

veldscholte
Posts: 6
Joined: Sat Nov 14, 2009 6:22 pm

Re: Replace harddisk for larger one

Post by veldscholte » Tue Nov 24, 2009 8:13 pm

I made a copy of the partitions of my old NAS disk, copied the file to my backup disk. deleted the partitions of the old NAS disk (gparted) and was able to restore the partitions using dd again. So it seems everything works fine.
Now I'm puzzled by your last reply. I think you tried to help me making a backup of my windows system. This sounds great to me but the way you describe it puzzles me:
Shouldn't be the mnt/Windows_C part be at the left side? If you want to copy it to a file?
Like: sudo dd if=/mnt/Windows_C of=myfilename bs=1024 count 1200000?

Probably I'm not getting it. Could you explain?

Mijzelf
Posts: 6199
Joined: Mon Jun 16, 2008 10:45 am

Re: Replace harddisk for larger one

Post by Mijzelf » Tue Nov 24, 2009 9:42 pm

I was trying to explain how to get your 1.2GB dumpfile on your Windows systemdisk, when booted from an Ubuntu liveCD.
When you just open a terminal and type 'dd if=/dev/sda of=dumpfile', the dumpfile is stored on a RAMdisk, and will be gone when you reboot. AFAIK the Ubuntu CD mounts the Windows partitions readonly, so some work has to be done to get the file on a safe place.

Of course you can make a backup of your windows installation using dd, the command is 'dd if=/dev/sda of=dumpfile', or 'dd if=/dev/sda1 of=dumpfile' if you only want to backup a single partition.
The dumpfile will be as big as the Windows disk or partition, so maybe this is not a good idea. (You will copy all empty space as well)

Post Reply