lvextend and resize2fs without umount?

Posted on 2011-04-25
Last Modified: 2012-05-11
can we increase the filesystem without umount? Would it corrupt any data?
Question by:mokkan
    LVL 76

    Accepted Solution

    Backup and try.
    Better safe than sorry, would be the advice to resize while the filesystem is not in use by other services. and a goof backup exists just in case.
    the resize2fs is more risky as compared to the lvextend
    Presumably you have already expanded the Volume group (vgextend) or do you have excess room in the volume group?
    LVL 4

    Assisted Solution

    if you want resize or work with mounted system, mount it with read only parametrs, so you not lose any data.

    but many programs for resize today, not allow you work with mounted system anyway.

    Author Comment

    thank you. what is the difference between resize2fs and ext2online?
    LVL 76

    Expert Comment

    ext2online will only resize ext2 mounted filesystem.

    resize2fs will resize an ext2 or ext3 unmounted file system.

    Author Comment

    How can we execute on mounted file system?

    Author Comment

    How can we execute on mounted ext3 file system? Or what command we can execute?
    LVL 4

    Assisted Solution

    Different between mounted system, or not  mounted, in Linux filesystem, mounted file system always
    wright/read data

    you can get list of open files by

    sudo lsof

    so if you resize partition, you must have free space, ext2online i think just add new free space in allocation table, but i think they can only large size..

    So whats bad if you work with Resize, fsck and other things in mounted file system:

    Programm, change file allocation, and in same time, Linux may wright data in same place, so data moved, and Linux wright new data, on empty space, or in programm/log/tmp, or cache data.. so it can broke this file..

     Most Vaulrnable if you work in mounted FS is : /var , /etc , /tmp /usr (config files), but if programm like resize2fs, start moving any system file, and any daemon/program, or process, wright data on disk, they could seriously damage your system.. but this is 5-10% of chance, becouse most of all /sbin /boot /bin files, are always static..

    btw resize2fs, can also move partitions..

    so best way, to prevent any damage is remout filesystem in RO mode..
    most of "damage or not" depends, where your logical disc is


    [[       /root            ext 4               ] [         /boot     ext4       ][           /partition that i want to resize    ]       empty space       ]

    so in this state, this is safaty to resize it.. but here:

    [[empty space  [            /root               ][        /partition for resize ] [        /boot        ]

    to resize your partition
    1. you need move /root partition to start of system (i miss that / you can't load this disk on most system, becouse of 1024 cylinder problem)
    2. then you add size into !START of logical disk, so, and other files into /partition for resize
    move on their allocation table

    like we start from

    file 1 0x00000001
    file 2 0x00000004
    file 3 0x00000005


    file 1 0x00000005
    file 2 0x00000008
    file 3 0x00000009

    so on mount system if any process wright data on file 2, they just damage file 1 and overwright it.

    in first state you just add more disk space so discriptors not changes, and file system not been damaged.

    Author Closing Comment

    thank you.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
    Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now