Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 12th March 2010, 10:00
autogun autogun is offline
Member
 
Join Date: Sep 2009
Posts: 69
Thanks: 9
Thanked 5 Times in 5 Posts
Default HDDs, Partitions and other stuff

Howdy all,

I've a server running with 2 HDDs.
40GB IDE Hitachi IC35L060AVV207-0 - /dev/hda1
40GB IDE WDC WD400BB-23DEA0 - /dev/hdc1

/dev/hda1 have 2 partitions which is mounted as /boot, swap partition and 34GB of unallocated space.
/dev/hdc1 have 1 partition with all my relevant data and mounted as /.

I suspect /dev/hdc1 is a faulty harddrive and would like to allocate 34GB of /dev/hda1 so I can copy all the data from /dev/hdc1, mount it as / and totally remove /dev/hdc1 from my system.

Now, since Im not a linux expert at all, I'd love to hear what's the best way of doing this, can it be done remotely at all?

Thanks in advance!
Reply With Quote
Sponsored Links
  #2  
Old 13th March 2010, 14:17
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,744 Times in 2,577 Posts
Default

You'd have to create a new partition on /dev/hda for /, copy over the stuff from the current / partition (e.g. with dd), modify your /etc/fstab and maybe /etc/boot/grub/menu.lst and reboot.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 13th March 2010, 17:58
autogun autogun is offline
Member
 
Join Date: Sep 2009
Posts: 69
Thanks: 9
Thanked 5 Times in 5 Posts
Default

Thanks falko!

Is it possible creating new partition remotely?

[edit]
Ok, I probably should use fdisk,
Code:
fdisk -l

Disk /dev/hda: 40.0 GB, 40016019456 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14         110      779152+  82  Linux swap / Solaris

Disk /dev/hdc: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdc1   *           1        4865    39078081   83  Linux
Code:
fdisk /dev/hda

The number of cylinders for this disk is set to 4865.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):
Code:
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4):
What should be the input now?

Last edited by autogun; 13th March 2010 at 19:17.
Reply With Quote
  #4  
Old 14th March 2010, 12:26
autogun autogun is offline
Member
 
Join Date: Sep 2009
Posts: 69
Thanks: 9
Thanked 5 Times in 5 Posts
Default

I almost did it, really...

I've created /dev/hda3, formatted it using mkfs -t ext3.
Labeled it as / using e2label /dev/hda3
Labeled old / (/dev/hdc1) as /oldroot

Used dd if=/dev/hdc1 of=/dev/hda3 bs=4096 conv=notrunc,noerror to clone the partition.

I've even mounted /dev/hda3 to /mnt and checked - everything was there..

Rebooted the server and it didnt go up

Heheh, I feel silly...
Reply With Quote
  #5  
Old 14th March 2010, 15:56
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,744 Times in 2,577 Posts
Default

What's in /etc/fstab and /boot/grub/menu.lst?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #6  
Old 15th March 2010, 07:59
autogun autogun is offline
Member
 
Join Date: Sep 2009
Posts: 69
Thanks: 9
Thanked 5 Times in 5 Posts
Default

Hi falko,

This is how it looks now when I set /etc/fstab back to its original settings -
(/oldroot is /dev/hdc1 - the hdd I want to be removed - /dev/hda3 is the new root that didnt work)
Code:
LABEL=/oldroot          /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-hda2         swap                    swap    defaults        0 0
And this is /boot/grub/menu.lst - I didnt touch anything here
Code:
#boot=/dev/hda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
#hiddenmenu
title trixbox (2.6.18-128.1.10.el5xen)
        root (hd0,0)
        kernel /xen.gz-2.6.18-128.1.10.el5
        module /vmlinuz-2.6.18-128.1.10.el5xen ro root=LABEL=/
        module /initrd-2.6.18-128.1.10.el5xen.img
title trixbox-base (2.6.18-128.1.10.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-128.1.10.el5 ro root=LABEL=/
        initrd /initrd-2.6.18-128.1.10.el5.img
Reply With Quote
  #7  
Old 15th March 2010, 14:20
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,744 Times in 2,577 Posts
Default

Can you try this?
Code:
/dev/hda3          /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-hda2         swap                    swap    defaults        0 0

Code:
#boot=/dev/hda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
#hiddenmenu
title trixbox (2.6.18-128.1.10.el5xen)
        root (hd0,0)
        kernel /xen.gz-2.6.18-128.1.10.el5
        module /vmlinuz-2.6.18-128.1.10.el5xen ro root=/dev/hda3
        module /initrd-2.6.18-128.1.10.el5xen.img
title trixbox-base (2.6.18-128.1.10.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-128.1.10.el5 ro root=/dev/hda3
        initrd /initrd-2.6.18-128.1.10.el5.img
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
The Following 2 Users Say Thank You to falko For This Useful Post:
autogun (15th March 2010), devillyto (2nd May 2010)
  #8  
Old 15th March 2010, 22:28
autogun autogun is offline
Member
 
Join Date: Sep 2009
Posts: 69
Thanks: 9
Thanked 5 Times in 5 Posts
 
Default

Thank you so much, falko!
Works like a charm!!

Im so happy!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:46.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.