HDDs, Partitions and other stuff

Discussion in 'Installation/Configuration' started by autogun, Mar 12, 2010.

  1. autogun

    autogun New Member

    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!
     
  2. falko

    falko Super Moderator

    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.
     
  3. autogun

    autogun New Member

    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: Mar 13, 2010
  4. autogun

    autogun New Member

    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 :mad:

    Heheh, I feel silly...
     
  5. falko

    falko Super Moderator

    What's in /etc/fstab and /boot/grub/menu.lst?
     
  6. autogun

    autogun New Member

    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
    
     
  7. falko

    falko Super Moderator

    Can you try this?
    Code:
    [COLOR="Red"]/dev/hda3[/COLOR]          /                       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=[COLOR="Red"]/dev/hda3[/COLOR]
            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=[COLOR="Red"]/dev/hda3[/COLOR]
            initrd /initrd-2.6.18-128.1.10.el5.img
     
  8. autogun

    autogun New Member

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

    Im so happy! :cool:
     

Share This Page