You are not logged in.

#1 2015-05-29 17:28:20

rhodie
Member
Registered: 2012-03-19
Posts: 45

[SOLVED] Remote install: how to convert LVM swap to a linux partition

I am trying to install arch onto a remote server using the instructions at https://wiki.archlinux.org/index.php/Re … ux_Install , which outline a way to convert the swap partition to the new root partition:

# swapoff /dev/sdaX
# fdisk /dev/sda
(set /dev/sdaX ID field to "Linux" - Hex 83)
# mke2fs -j /dev/sdaX

The problem I'm having is that the disks on the server are managed by LVM and I'm not sure how to convert the swap partition.  How do I make it available for the install?  fdisk does not want to operate on the disks because it doesn't support GPT.  Can parted do it?  Alternatively, the server has two hard drives so maybe one could be used for the install.

/etc/fstab contains

/dev/mapper/nc1-root /               ext3    errors=remount-ro 0       1
# /boot was on /dev/sda2 during installation
UUID=c9bcfdd6-ae9a-4ea9-b679-53f29b95c63c /boot           ext2    defaults        0       2
/dev/mapper/nc1-swap_1 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0

fdisk -l gives

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1      243202  1953514583+  ee  GPT

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x36613b58

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          63      498688   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2              63      243202  1953014784   fd  Linux raid autodetect

Disk /dev/dm-0: 1967.2 GB, 1967191490560 bytes
255 heads, 63 sectors/track, 239164 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 32.9 GB, 32946257920 bytes
255 heads, 63 sectors/track, 4005 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

dmsetup info gives

Name:              nc1-root
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        1
Event number:      0
Major, minor:      254, 0
Number of targets: 1
UUID: LVM-Jlpnv3mTyxFgW3HKlMKlaTsGN0Edd0n3iybhIaeGjTu7l27UQXd7TTMfVuhFyKzJ

Name:              nc1-swap_1
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        1
Event number:      0
Major, minor:      254, 1
Number of targets: 1
UUID: LVM-Jlpnv3mTyxFgW3HKlMKlaTsGN0Edd0n32wFEDu3V7u1C540QamjiPSe4qGR10o1A

parted print all gives

Model: ATA WDC WD2002FYPS-0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  1018kB  1000kB                     bios_grub
 2      1018kB  257MB   256MB   ext2               boot
 3      257MB   2000GB  2000GB                     lvm


Model: ATA WDC WD2002FYPS-0 (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  512MB   511MB   primary               boot, raid
 2      512MB   2000GB  2000GB  primary               raid


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/nc1-swap_1: 32.9GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system     Flags
 1      0.00B  32.9GB  32.9GB  linux-swap(v1)


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/nc1-root: 1967GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  1967GB  1967GB  ext3

Last edited by rhodie (2015-05-31 08:39:02)

Offline

#2 2015-05-30 06:56:59

MSC
Member
Registered: 2014-07-13
Posts: 33

Re: [SOLVED] Remote install: how to convert LVM swap to a linux partition

gdisk is a GPT analog of fdisk, FYI. However, since the swap partition is inside an LVM container, you don't need to touch the underlying disk at all. You should be able to run mkfs on the partition immediately after swapoff.

Offline

#3 2015-05-30 10:41:14

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [SOLVED] Remote install: how to convert LVM swap to a linux partition

Thank you, that worked.

Offline

Board footer

Powered by FluxBB