LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-27-2012, 03:47 PM   #1
Docky
LQ Newbie
 
Registered: Aug 2012
Posts: 19

Rep: Reputation: Disabled
How to allocate more space to rootfs?


This is my system on my current Debian box:

Code:
Filesystem      Size  Used Avail Use% Mounted on
rootfs          9.8G  2.5G  6.9G  27% /
/dev/root       9.8G  2.5G  6.9G  27% /
tmpfs           1.6G  340K  1.6G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            10M     0   10M   0% /dev
tmpfs           3.4G     0  3.4G   0% /run/shm
/dev/md2        921G  7.1G  868G   1% /home
From here I see that rootfs only has 9.8GB, I would like to allocate it more space from /dev/md2 so that I can use more space outside of /home. How would I do this?
 
Old 08-27-2012, 03:57 PM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,969
Blog Entries: 1

Rep: Reputation: 208Reputation: 208Reputation: 208
Quote:
Originally Posted by Docky View Post
This is my system on my current Debian box:

Code:
Filesystem      Size  Used Avail Use% Mounted on
rootfs          9.8G  2.5G  6.9G  27% /
/dev/root       9.8G  2.5G  6.9G  27% /
tmpfs           1.6G  340K  1.6G   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            10M     0   10M   0% /dev
tmpfs           3.4G     0  3.4G   0% /run/shm
/dev/md2        921G  7.1G  868G   1% /home
From here I see that rootfs only has 9.8GB, I would like to allocate it more space from /dev/md2 so that I can use more space outside of /home. How would I do this?

Are you running LVM? Or some sort of filesystem that allows for growing/shrinking filesystems?

Run these commands...

Code:
pvs
vgs
lvs
And post the output

--C
 
Old 08-27-2012, 04:01 PM   #3
Docky
LQ Newbie
 
Registered: Aug 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by custangro View Post
Are you running LVM? Or some sort of filesystem that allows for growing/shrinking filesystems?

Run these commands...

Code:
pvs
vgs
lvs
And post the output

--C
Code:
[~] sudo pvs
[~] sudo vgs
  No volume groups found
[~] sudo lvs
  No volume groups found
[~]
 
Old 08-27-2012, 04:25 PM   #4
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Unless you are able to apply LVM, you would have to repartition /dev/md2 - back up ALL your data before doing this in case something goes wrong - and make a new partition.

Instead of just increasing the space for / you could mount one of the directories on another partition - such as /var.
 
Old 09-02-2012, 09:32 PM   #5
Docky
LQ Newbie
 
Registered: Aug 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Bump.

Quote:
Originally Posted by SecretCode View Post
Unless you are able to apply LVM, you would have to repartition /dev/md2 - back up ALL your data before doing this in case something goes wrong - and make a new partition.

Instead of just increasing the space for / you could mount one of the directories on another partition - such as /var.
I can't repartition it as it's already in use. I just need to know how I can shrink /dev/md2 and increase the size of /.
 
Old 09-03-2012, 01:38 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
What does
Code:
fdisk -l
show (lowercase L there)
 
Old 09-03-2012, 02:45 AM   #7
Docky
LQ Newbie
 
Registered: Aug 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
What does
Code:
fdisk -l
show (lowercase L there)
Code:
[~] sudo fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000c155b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        4096    20482048    10238976+  fd  Linux raid autodetect
/dev/sda2        20482049  1952471040   965994496   fd  Linux raid autodetect
Partition 2 does not start on physical sector boundary.
/dev/sda3      1952471041  1953517568      523264   82  Linux swap / Solaris
Partition 3 does not start on physical sector boundary.

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00025ed0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            4096    20482048    10238976+  fd  Linux raid autodetect
/dev/sdb2        20482049  1952471040   965994496   fd  Linux raid autodetect
Partition 2 does not start on physical sector boundary.
/dev/sdb3      1952471041  1953517568      523264   82  Linux swap / Solaris
Partition 3 does not start on physical sector boundary.

Disk /dev/md1: 10.5 GB, 10484645888 bytes
2 heads, 4 sectors/track, 2559728 cylinders, total 20477824 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/md2: 989.2 GB, 989178298368 bytes
2 heads, 4 sectors/track, 241498608 cylinders, total 1931988864 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Alignment offset: 3584 bytes
Disk identifier: 0x00000000

Disk /dev/md2 doesn't contain a valid partition table
[~]
I know there's two drives there, but I'm only using the first one as it's the only one I need (not even sure if the second one is mounted).
 
Old 09-03-2012, 05:45 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Ok, I'd like to see this
Code:
mdadm --detail /dev/md1

mdadm --detail /dev/md2
but it looks like you've got 2 x 1TB disks, sda+sdb, each split 3 ways

1. root - mirrored on both - md1 (sda1+sdb1)
2. home - mirrored on both - md2 (sda2+sdb2)
3. 2 x swap - not mirrored - sda3, sdb3


You can only shrink a partition from the top down ie from the farthest end, backwards towards the start, so shrinking /home to add space to '/' is not practical.
(On your disks, '/' comes physically before /home)

You can

1. backup & re-partition; actually not a bad idea, and you should be making backups anyway

2. it would be possible to shrink the /home partition and put eg /var on the new space.
Remember to shrink the fs first, then the RAID partitions ie sda2+sdb2.

You definitely must do a backup before you try this.
 
Old 09-03-2012, 07:09 AM   #9
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
yes, shrink /home first and create another partition. copy your data from / (or from /bin, /var ...) onto the new partition (the whole filesystem you want to put onto the new drive), reconfigure fstab. create mount points by renaming old /var. Take care about preserving all the permissions. All of these should be done by booting another OS (probably a CD). Reboot, check, and start over in case of error. You can safely restore the original state as long as you can restore the old fstab and /var (and other dirs).
 
Old 09-03-2012, 10:09 AM   #10
Docky
LQ Newbie
 
Registered: Aug 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
Ok, I'd like to see this
Code:
mdadm --detail /dev/md1

mdadm --detail /dev/md2
but it looks like you've got 2 x 1TB disks, sda+sdb, each split 3 ways

1. root - mirrored on both - md1 (sda1+sdb1)
2. home - mirrored on both - md2 (sda2+sdb2)
3. 2 x swap - not mirrored - sda3, sdb3


You can only shrink a partition from the top down ie from the farthest end, backwards towards the start, so shrinking /home to add space to '/' is not practical.
(On your disks, '/' comes physically before /home)

You can

1. backup & re-partition; actually not a bad idea, and you should be making backups anyway

2. it would be possible to shrink the /home partition and put eg /var on the new space.
Remember to shrink the fs first, then the RAID partitions ie sda2+sdb2.

You definitely must do a backup before you try this.
I'll need to look into that more before I re-partition anything. Here's the output of those commands:

Code:
[~] mdadm --detail /dev/md1
/dev/md1:
        Version : 0.90
  Creation Time : Mon Aug 27 06:02:17 2012
     Raid Level : raid1
     Array Size : 10238912 (9.76 GiB 10.48 GB)
  Used Dev Size : 10238912 (9.76 GiB 10.48 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 1
    Persistence : Superblock is persistent

    Update Time : Mon Sep  3 15:08:09 2012
          State : active 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : 62fd2a8d:4fd0962f:a4d2adc2:26fd5302
         Events : 0.7

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
[~] mdadm --detail /dev/md2
/dev/md2:
        Version : 0.90
  Creation Time : Mon Aug 27 06:02:23 2012
     Raid Level : raid1
     Array Size : 965994432 (921.24 GiB 989.18 GB)
  Used Dev Size : 965994432 (921.24 GiB 989.18 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 2
    Persistence : Superblock is persistent

    Update Time : Mon Sep  3 15:08:07 2012
          State : clean 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : e296cbcf:93113984:a4d2adc2:26fd5302
         Events : 0.30

    Number   Major   Minor   RaidDevice State
       0       8        2        0      active sync   /dev/sda2
       1       8       18        1      active sync   /dev/sdb2
[~]
 
Old 09-03-2012, 11:34 AM   #11
aristocratic
Member
 
Registered: Sep 2011
Location: Texas
Distribution: Open SuSE 12.1, Lucid Puppy
Posts: 90

Rep: Reputation: Disabled
In your original question, what command did you use to get this output? I am familiar with the fdisk -l command, but not the command you used.

Filesystem Size Used Avail Use% Mounted on
rootfs 9.8G 2.5G 6.9G 27% /
/dev/root 9.8G 2.5G 6.9G 27% /
tmpfs 1.6G 340K 1.6G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 10M 0 10M 0% /dev
tmpfs 3.4G 0 3.4G 0% /run/shm
/dev/md2 921G 7.1G 868G 1% /home

F
 
Old 09-03-2012, 12:19 PM   #12
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
aristocratic, the OP output is from
Code:
df -h
 
Old 09-03-2012, 05:55 PM   #13
Docky
LQ Newbie
 
Registered: Aug 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by aristocratic View Post
In your original question, what command did you use to get this output? I am familiar with the fdisk -l command, but not the command you used.

Filesystem Size Used Avail Use% Mounted on
rootfs 9.8G 2.5G 6.9G 27% /
/dev/root 9.8G 2.5G 6.9G 27% /
tmpfs 1.6G 340K 1.6G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 10M 0 10M 0% /dev
tmpfs 3.4G 0 3.4G 0% /run/shm
/dev/md2 921G 7.1G 868G 1% /home

F
I used df -h

Code:
Filesystem      Size  Used Avail Use% Mounted on
rootfs          9.8G  7.9G  1.5G  85% /
udev             10M     0   10M   0% /dev
tmpfs           1.6G  1.4M  1.6G   1% /run
/dev/md1        9.8G  7.9G  1.5G  85% /
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.4G  4.0K  3.4G   1% /run/shm
/dev/md2        921G   55G  820G   7% /home
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I find out if I can allocate more space to LVM? Thaidog Linux - General 4 03-31-2011 08:30 PM
User wants to allocate more than 3Gb memory space in RHel5 batkinso Red Hat 3 07-24-2007 11:21 AM
Space for Auto Allocate partitioning? Pekay Mandriva 12 01-19-2006 06:46 PM
How to allocate a block of 16MB in kernel space using my driver module s_anumolu Linux - General 1 07-15-2005 01:48 AM
Need to allocate more space to email - Help lizard99 Linux - Software 5 04-23-2005 10:56 AM


All times are GMT -5. The time now is 02:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration