Results 1 to 2 of 2

Thread: Create swap partition after install

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Create swap partition after install

    I already have parititon contain data under lvm enviroment with centos 5.8

    output of fdisk -l

    Code:
        Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
        255 heads, 63 sectors/track, 121601 cylinders
        Units = cylinders of 16065 * 512 = 8225280 bytes
        
           Device Boot      Start         End      Blocks   Id  System
        /dev/sda1   *           1          25      200781   83  Linux
        /dev/sda2              26      121601   976559220   8e  Linux LVM
    output of lvdisplay

    Code:
       # lvdisplay
          --- Logical volume ---
          LV Name                /dev/sysvg/ROOT
          VG Name                sysvg
          LV UUID                6oy3Rj-ka3K-mL9s-vjjG-1Iqw-dniq-UbWzvJ
          LV Write Access        read/write
          LV Status              available
          # open                 1
          LV Size                919.44 GB
          Current LE             29422
          Segments               1
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:0
        
          --- Logical volume ---
          LV Name                /dev/sysvg/TMP
          VG Name                sysvg
          LV UUID                jTKLBt-eNz0-KxmV-E5Nk-jjC0-FlRb-qny62p
          LV Write Access        read/write
          LV Status              available
          # open                 1
          LV Size                9.88 GB
          Current LE             316
          Segments               1
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:1
        
          --- Logical volume ---
          LV Name                /dev/sysvg/SHM
          VG Name                sysvg
          LV UUID                NpKjhl-tzzn-Dk3G-A6dl-4QJB-QCc2-IkbDH5
          LV Write Access        read/write
          LV Status              available
          # open                 1
          LV Size                2.00 GB
          Current LE             64
          Segments               1
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:2
    output of df -h
    Code:
        root@server [~]# df -h
        Filesystem            Size  Used Avail Use% Mounted on
        /dev/mapper/sysvg-ROOT
                              891G  125G  721G  15% /
        /dev/mapper/sysvg-TMP
                              9.6G  153M  9.0G   2% /tmp
        /dev/mapper/sysvg-SHM
                              8.0G  8.0K  8.0G   1% /dev/shm
        /dev/sda1             190M   19M  162M  11% /boot
        tmpfs                 8.0G  8.0K  8.0G   1% /dev/shm
    output for /etc/fstab
    Code:
        root@server [~]# cat /etc/fstab
        /dev/sysvg/ROOT /       ext3    usrjquota=quota.user,jqfmt=vfsv0        1       1
        /dev/sysvg/TMP          /tmp                    ext3    defaults        1 2
        /dev/sysvg/SHM  /dev/shm        ext3    defaults,usrquota       1       2
        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
        /tmp             /var/tmp                    ext3    defaults,bind,noauto        0 0
    I don't have any idea how to create swap partition , and i worried about creating cause any DATA LOSS

  2. #2
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    It is easy....if you wish to have 512Mb swap , then follow as below:

    dd if=/dev/zero of=/myswap bs=1024 count=524288
    mkswap /myswap
    chown root:root /myswap
    chmod 600 /myswap
    swapon /myswap


    now, append in /etc/fstab file for persistence.

    /myswap swap swap defaults 0 0



    Quote Originally Posted by iLinux85 View Post
    I already have parititon contain data under lvm enviroment with centos 5.8

    output of fdisk -l

    Code:
        Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
        255 heads, 63 sectors/track, 121601 cylinders
        Units = cylinders of 16065 * 512 = 8225280 bytes
        
           Device Boot      Start         End      Blocks   Id  System
        /dev/sda1   *           1          25      200781   83  Linux
        /dev/sda2              26      121601   976559220   8e  Linux LVM
    output of lvdisplay

    Code:
       # lvdisplay
          --- Logical volume ---
          LV Name                /dev/sysvg/ROOT
          VG Name                sysvg
          LV UUID                6oy3Rj-ka3K-mL9s-vjjG-1Iqw-dniq-UbWzvJ
          LV Write Access        read/write
          LV Status              available
          # open                 1
          LV Size                919.44 GB
          Current LE             29422
          Segments               1
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:0
        
          --- Logical volume ---
          LV Name                /dev/sysvg/TMP
          VG Name                sysvg
          LV UUID                jTKLBt-eNz0-KxmV-E5Nk-jjC0-FlRb-qny62p
          LV Write Access        read/write
          LV Status              available
          # open                 1
          LV Size                9.88 GB
          Current LE             316
          Segments               1
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:1
        
          --- Logical volume ---
          LV Name                /dev/sysvg/SHM
          VG Name                sysvg
          LV UUID                NpKjhl-tzzn-Dk3G-A6dl-4QJB-QCc2-IkbDH5
          LV Write Access        read/write
          LV Status              available
          # open                 1
          LV Size                2.00 GB
          Current LE             64
          Segments               1
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:2
    output of df -h
    Code:
        root@server [~]# df -h
        Filesystem            Size  Used Avail Use% Mounted on
        /dev/mapper/sysvg-ROOT
                              891G  125G  721G  15% /
        /dev/mapper/sysvg-TMP
                              9.6G  153M  9.0G   2% /tmp
        /dev/mapper/sysvg-SHM
                              8.0G  8.0K  8.0G   1% /dev/shm
        /dev/sda1             190M   19M  162M  11% /boot
        tmpfs                 8.0G  8.0K  8.0G   1% /dev/shm
    output for /etc/fstab
    Code:
        root@server [~]# cat /etc/fstab
        /dev/sysvg/ROOT /       ext3    usrjquota=quota.user,jqfmt=vfsv0        1       1
        /dev/sysvg/TMP          /tmp                    ext3    defaults        1 2
        /dev/sysvg/SHM  /dev/shm        ext3    defaults,usrquota       1       2
        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
        /tmp             /var/tmp                    ext3    defaults,bind,noauto        0 0
    I don't have any idea how to create swap partition , and i worried about creating cause any DATA LOSS

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to create and install MySQl Databasa?
    By Jasmin in forum Databases servers
    Replies: 3
    Last Post: 21st May 2011, 04:20 AM
  2. How to add a logical partition to an extended partition?
    By jester in forum CentOS / RHEL / Fedora
    Replies: 3
    Last Post: 17th December 2010, 04:32 PM
  3. Why Swap=2 x RAM
    By diptanjan in forum Getting started tutorials
    Replies: 5
    Last Post: 25th March 2008, 01:14 AM
  4. Difference between Linux Swap partition & Swap file
    By hrishikesh in forum Linux software
    Replies: 9
    Last Post: 16th March 2007, 02:08 AM
  5. Deleted SWAP partition
    By sonaikar in forum Linux software
    Replies: 1
    Last Post: 5th February 2005, 06:20 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41