Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   CentOS Docs (http://www.linux-archive.org/centos-docs/)
-   -   LUKS create_encrypted_fs (http://www.linux-archive.org/centos-docs/431747-luks-create_encrypted_fs.html)

Jim Angstadt 09-25-2010 11:02 PM

LUKS create_encrypted_fs
 
Hi All,

This is my first post to centos-docs. I've read several months of
archives, but, this may be too trivial.

Re: http://wiki.centos.org/TipsAndTricks/EncryptedFilesystem/Scripts

This line:

FREE_SPACE=$(df -m $SECRET_PATH |grep / | awk '{ print $4 }')

gave me a problem due to line wrapping in df. For example:

$ df -m /home/ja/verify/
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
589333 289168 269746 52% /

So, $4 is 52% rather than 269746.

The '/dev/mapper/VolGroup00-LogVol00' term is from a fresh install,
so, perhaps others have this same name.

This change worked for me:
FREE_SPACE=$(${DF} -m ${PATH} | ${GREP} /
| ${TR} "
" ' ' | ${TR} -s ' ' | ${CUT} -d' ' -f4)

Note the reformating onto 1 line with TR. The remainder could be what
I have, the original awk statement, or whatever. Thanks for your
consideration.

JIm
_______________________________________________
CentOS-docs mailing list
CentOS-docs@centos.org
http://lists.centos.org/mailman/listinfo/centos-docs

Laszlo Fekete 09-25-2010 11:07 PM

LUKS create_encrypted_fs
 
Maybe the df manual can help you:

-P, --portability use the POSIX output format


On 09/26/2010 01:02 AM, Jim Angstadt wrote:
> Hi All,
>
> This is my first post to centos-docs. I've read several months of
> archives, but, this may be too trivial.
>
> Re: http://wiki.centos.org/TipsAndTricks/EncryptedFilesystem/Scripts
>
> This line:
>
> FREE_SPACE=$(df -m $SECRET_PATH |grep / | awk '{ print $4 }')
>
> gave me a problem due to line wrapping in df. For example:
>
> $ df -m /home/ja/verify/
> Filesystem 1M-blocks Used Available Use% Mounted on
> /dev/mapper/VolGroup00-LogVol00
> 589333 289168 269746 52% /
>
> So, $4 is 52% rather than 269746.
>
> The '/dev/mapper/VolGroup00-LogVol00' term is from a fresh install,
> so, perhaps others have this same name.
>
> This change worked for me:
> FREE_SPACE=$(${DF} -m ${PATH} | ${GREP} /
> | ${TR} "
" ' ' | ${TR} -s ' ' | ${CUT} -d' ' -f4)
>
> Note the reformating onto 1 line with TR. The remainder could be what
> I have, the original awk statement, or whatever. Thanks for your
> consideration.
>
> JIm
> _______________________________________________
> CentOS-docs mailing list
> CentOS-docs@centos.org
> http://lists.centos.org/mailman/listinfo/centos-docs
>

_______________________________________________
CentOS-docs mailing list
CentOS-docs@centos.org
http://lists.centos.org/mailman/listinfo/centos-docs

Jim Angstadt 09-25-2010 11:20 PM

LUKS create_encrypted_fs
 
On Sat, Sep 25, 2010 at 4:07 PM, Laszlo Fekete <blackluck@ktk.bme.hu> wrote:
> Maybe the df manual can help you:
>
> *-P, --portability * * use the POSIX output format

Thanks for you reply. Yes, that works also.

Do you think that the page should be changed, or is this too trivial?

Jim
_______________________________________________
CentOS-docs mailing list
CentOS-docs@centos.org
http://lists.centos.org/mailman/listinfo/centos-docs

Ralph Angenendt 09-26-2010 03:46 PM

LUKS create_encrypted_fs
 
Am 26.09.10 01:02, schrieb Jim Angstadt:

> gave me a problem due to line wrapping in df. For example:
>
> $ df -m /home/ja/verify/
> Filesystem 1M-blocks Used Available Use% Mounted on
> /dev/mapper/VolGroup00-LogVol00
> 589333 289168 269746 52% /
>
> So, $4 is 52% rather than 269746.

ARGH. IDIOTS.

Changed it to df -P -m in the script.

Thanks for finding that.

Ralph
_______________________________________________
CentOS-docs mailing list
CentOS-docs@centos.org
http://lists.centos.org/mailman/listinfo/centos-docs


All times are GMT. The time now is 11:17 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.