View Full Version : HDDs, Partitions and other stuff
autogun
12th March 2010, 10:00
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!
falko
13th March 2010, 14:17
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.
autogun
13th March 2010, 17:58
Thanks falko!
Is it possible creating new partition remotely?
[edit]
Ok, I probably should use fdisk,
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
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):
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?
autogun
14th March 2010, 12:26
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...
falko
14th March 2010, 15:56
What's in /etc/fstab and /boot/grub/menu.lst?
autogun
15th March 2010, 07:59
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)
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
#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
falko
15th March 2010, 14:20
Can you try this?
/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
#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
autogun
15th March 2010, 22:28
Thank you so much, falko!
Works like a charm!! :D
Im so happy! :cool:
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.