Koozali.org: home of the SME Server

extend /dev/mapper/mainroot

Offline thejay

  • ***
  • 53
  • +0/-0
extend /dev/mapper/mainroot
« on: February 28, 2007, 11:09:12 AM »
My HD is full and i want extend the partition /dev/mapper/mainroot, i have free space in the HD.

Can you help me with this?

see my drive:
"[root@servidor ~]# df
S.ficheros         Bloques de 1K   Usado    Dispon Uso% Montado en
/dev/mapper/main-root
                       2322240           2322240         0 100% /
/dev/md1           101018           25268     70534  27% /boot
none                    257248         0           257248   0% /dev/shm
[root@servidor ~]#"

PD: sorry for my english.

Offline ldkeen

  • *
  • 403
  • +0/-0
extend /dev/mapper/mainroot
« Reply #1 on: February 28, 2007, 01:03:02 PM »
thejay,
The 75mb that you have free is on /dev/md1 (/boot) and is required for normal system operation. Besides that it would be hardly worth stuffing around with to gain an extra 75MB of disk space. Why dont you just grab a new drive and replace the old drive? You can find instructions to replace the hard disk here: http://smeserver.sourceforge.net/sme7/tech/Chapter8#h1137-6
Regards, Lloyd

Offline thejay

  • ***
  • 53
  • +0/-0
extend /dev/mapper/mainroot
« Reply #2 on: February 28, 2007, 01:07:46 PM »
No, no, i have 13 Gigabytes unformat free space in the same disk.

Offline ldkeen

  • *
  • 403
  • +0/-0
extend /dev/mapper/mainroot
« Reply #3 on: February 28, 2007, 01:34:03 PM »
What is the output of:
Code: [Select]
#fdisk /dev/hdx
Lloyd

Offline thejay

  • ***
  • 53
  • +0/-0
output of fdisk /dev/hdc
« Reply #4 on: February 28, 2007, 02:04:54 PM »
number of cylinders for this drive is 2434
Is not wrong, but is > than 1024, and sometimes could cause problems with:
1/ software which works in the start (eg. old versions of lilo)
2/ boot software or partitioning of others SO ( eg. FDISK of DOS, FDISK of OS/2)
..
..
..
Order (m for help):


--------------------------------------------------------
Another outputs
--------------------------------------------------------
login as: root
root@192.168.1.4's password:
Last login: Wed Feb 28 10:05:57 2007 from 192.168.1.6
[root@servidor ~]# df
S.ficheros         Bloques de 1K   Usado    Dispon Uso% Montado en
/dev/mapper/main-root
                       2322240   2322240         0 100% /
/dev/md1                101018     25268     70534  27% /boot
none                    257248         0    257248   0% /dev/shm
[root@servidor ~]#
---------------------------------------------------------------------
login as: root
root@192.168.1.4's password:
Last login: Wed Feb 28 10:50:46 2007 from 192.168.1.6
[root@servidor ~]# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 hdc2[0]
      3060288 blocks [2/1] [U_]

md1 : active raid1 hdc1[0]
      104320 blocks [2/1] [U_]

unused devices: <none>
[root@servidor ~]#
-------------------------------------------------------------------------
login as: root
root@192.168.1.4's password:
Last login: Wed Feb 28 11:09:32 2007 from 192.168.1.6
[root@servidor ~]# vi /etc/mdadm.conf

# mdadm.conf written out by anaconda
DEVICE partitions
MAILADDR root
ARRAY /dev/md2 super-minor=2
ARRAY /dev/md1 super-minor=1
------------------------------------------------------------------------
login as: root
root@192.168.1.4's password:
Last login: Wed Feb 28 11:28:44 2007 from 192.168.1.6
[root@servidor ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/md2
  VG Name               main
  PV Size               2,91 GB / not usable 0
  Allocatable           yes
  PE Size (KByte)       32768
  Total PE              93
  Free PE               1
  Allocated PE          92
  PV UUID               CvfpHA-t1OV-EHf2-kri0-FQUY-HumO-iwb2AQ

[root@servidor ~]# vgdisplay
  --- Volume group ---
  VG Name               main
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               2,91 GB
  PE Size               32,00 MB
  Total PE              93
  Alloc PE / Size       92 / 2,88 GB
  Free  PE / Size       1 / 32,00 MB
  VG UUID               FAbg6s-ax1v-Rsv9-u2Z1-MXrR-iMf1-kO7YTH

[root@servidor ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/main/root
  VG Name                main
  LV UUID                g6Yoko-1oIa-DOW3-XCaC-RcPM-lLTT-LdDpqv
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                2,25 GB
  Current LE             72
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/main/swap
  VG Name                main
  LV UUID                e5g4GC-3TO7-dLlY-zWDC-3O0r-6q4E-24TZa3
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                640,00 MB
  Current LE             20
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:1

[root@servidor ~]# umount /dev/main/root
umount: /: dispositivo ocupado
umount: /: dispositivo ocupado
[root@servidor ~]# lvextend -L+5G /dev/main/root
  Extending logical volume root to 7,25 GB
  Insufficient suitable allocatable extents for logical volume root: 159 more

required
[root@servidor ~]#
-----------------------------------------------------------------

Offline ldkeen

  • *
  • 403
  • +0/-0
extend /dev/mapper/mainroot
« Reply #5 on: February 28, 2007, 02:13:45 PM »
I need the output of:
Code: [Select]
fdisk -l /dev/hdc
there were no values for fdisk in the previous post.
Lloyd

Offline thejay

  • ***
  • 53
  • +0/-0
extend /dev/mapper/mainroot
« Reply #6 on: February 28, 2007, 04:46:50 PM »
login as: root
root@192.168.1.4's password:
Last login: Wed Feb 28 13:49:04 2007 from 192.168.1.6
[root@servidor ~]# fdisk -l /dev/hdc

Disco /dev/hdc: 20.0 GB, 20020396032 bytes
255 cabezas, 63 sectores/pista, 2434 cilindros
Unidades = cilindros de 16065 * 512 = 8225280 bytes

Disposit. Boot      Start         End      Blocks   Id  System
/dev/hdc1   *           1          13      104391   fd  Linux raid autodetect
/dev/hdc2              14         394     3060382+  fd  Linux raid autodetect
[root@servidor ~]#

Offline ldkeen

  • *
  • 403
  • +0/-0
extend /dev/mapper/mainroot
« Reply #7 on: February 28, 2007, 09:04:21 PM »
BTW, why is your disk attached to the secondary controller (hdc)??. It should really be connected as the master on the primary ide controller (hda). Anyway:
MAKE SURE YOU HAVE A BACKUP BEFORE TRYING THIS!!
repartition /dev/hdc2
Code: [Select]
#fdisk /dev/hdc

The number of cylinders for this disk is set to 2434.
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): d
Partition number (1-4): 2

Command (m for help): n
Command action
  e   extended
  p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-2434, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-2434, default 2434):
Using default value 2434

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): fd
Changed system type of partition 2 to fd (Linux raid autodetect)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

boot into rescue mode and recreate the superblock
Code: [Select]
#mdadm --create /dev/md2 --level 1 --raid-devices=2 /dev/hdc2 missing
reboot into smeserver
Code: [Select]
mdadm --grow /dev/md2 --size=max (maybe this isnt required, but it wont hurt)
pvresize /dev/md2
lvresize -l +$(vgdisplay -c main | cut -d: -f16) main/root
ext2online -C0 /dev/main/root

Most of this was taken from:
http://forums.contribs.org/index.php?topic=34413.0
and
http://smeserver.sourceforge.net/sme7/tech/Chapter8#h1137-6
Lloyd

Offline thejay

  • ***
  • 53
  • +0/-0
extend /dev/mapper/mainroot
« Reply #8 on: March 01, 2007, 09:25:10 AM »
Thanks a lot for your help.

With this operation, can i conserve all data?

Offline ldkeen

  • *
  • 403
  • +0/-0
extend /dev/mapper/mainroot
« Reply #9 on: March 01, 2007, 12:07:19 PM »
Quote from: "thejay"
With this operation, can i conserve all data?

You shouldn't lose any data using this procedure, but if you've been around computers for a while - you'll know that things can and do go wrong at times and as such you should always have a backup prior to attempting anyhting like this.
Lloyd